diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 062f1b51..bec59438 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -51,6 +51,22 @@ jobs: run: npm run build:libs - run: npm run publint --workspaces --if-present + + - name: 🔍 Test permissions-policy + run: npm run test:ci -w packages/permissions-policy + + - name: ⬆️ Upload test coverage to Codecov (permissions-policy) + if: runner.os == 'Linux' + # if: matrix.os == 'ubuntu-latest' + # https://github.com/marketplace/actions/codecov + uses: codecov/codecov-action@v4 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + with: + fail_ci_if_error: false + files: ./packages/permissions-policy/lcov.info + flags: permissions-policy + # verbose: true - name: 🔍 Test 11ty-plugin Content-Security-Policy run: npm run test:ci -w packages/eleventy-plugin-content-security-policy @@ -73,18 +89,6 @@ jobs: DEBUG: Eleventy:EleventyErrorHandler,11ty-plugin* NODE_ENV: test run: npm run test:ci -w packages/eleventy-plugin-ensure-env-vars - - - name: 🔍 Test 11ty-plugin Permissions-Policy - run: npm run test:ci -w packages/eleventy-plugin-permissions-policy - - - name: ⬆️ Upload test coverage to Codecov (eleventy-plugin-permissions-policy) - uses: codecov/codecov-action@v4 - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - with: - fail_ci_if_error: false - files: ./packages/eleventy-plugin-permissions-policy/lcov.info - flags: eleventy-plugin-permissions-policy - name: 🔍 Test 11ty-plugin Plausible env: diff --git a/.github/workflows/release-to-npmjs.yaml b/.github/workflows/release-to-npmjs.yaml index c49e800e..f5b34a36 100644 --- a/.github/workflows/release-to-npmjs.yaml +++ b/.github/workflows/release-to-npmjs.yaml @@ -42,6 +42,9 @@ jobs: - name: 📦 Build all libraries run: npm run build:libs + + - name: 🔍 Test permissions-policy + run: npm run test:ci -w packages/permissions-policy - name: 🔍 Test 11ty-plugin Content-Security-Policy run: npm run test:ci -w packages/eleventy-plugin-content-security-policy @@ -52,9 +55,6 @@ jobs: NODE_ENV: test run: npm run test:ci -w packages/eleventy-plugin-ensure-env-vars - - name: 🔍 Test 11ty-plugin Permissions-Policy - run: npm run test:ci -w packages/eleventy-plugin-permissions-policy - - name: 🔍 Test 11ty-plugin Plausible env: PLAUSIBLE: ${{ secrets.PLAUSIBLE }} diff --git a/README.md b/README.md index 13518dbd..96039c98 100644 --- a/README.md +++ b/README.md @@ -37,11 +37,11 @@ Monorepo for my [Eleventy](https://www.11ty.dev/) plugins. |---|---|---|---|---| | [@jackdbd/eleventy-plugin-content-security-policy](https://github.com/jackdbd/undici/tree/main/packages/eleventy-plugin-content-security-policy) | [![npm version](https://badge.fury.io/js/@jackdbd%2Feleventy-plugin-content-security-policy.svg)](https://badge.fury.io/js/@jackdbd%2Feleventy-plugin-content-security-policy) | [![install size](https://packagephobia.com/badge?p=@jackdbd/eleventy-plugin-content-security-policy)](https://packagephobia.com/result?p=@jackdbd/eleventy-plugin-content-security-policy) | [Coverage](https://app.codecov.io/gh/jackdbd/undici?flags%5B0%5D=eleventy-plugin-content-security-policy) | [Docs](https://jackdbd.github.io/undici/eleventy-plugin-content-security-policy/index.html) | | [@jackdbd/eleventy-plugin-ensure-env-vars](https://github.com/jackdbd/undici/tree/main/packages/eleventy-plugin-ensure-env-vars) | [![npm version](https://badge.fury.io/js/@jackdbd%2Feleventy-plugin-ensure-env-vars.svg)](https://badge.fury.io/js/@jackdbd%2Feleventy-plugin-ensure-env-vars) | [![install size](https://packagephobia.com/badge?p=@jackdbd/eleventy-plugin-ensure-env-vars)](https://packagephobia.com/result?p=@jackdbd/eleventy-plugin-ensure-env-vars) | [Coverage](https://app.codecov.io/gh/jackdbd/undici?flags%5B0%5D=eleventy-plugin-ensure-env-vars) | [Docs](https://jackdbd.github.io/undici/eleventy-plugin-ensure-env-vars/index.html) | -| [@jackdbd/eleventy-plugin-permissions-policy](https://github.com/jackdbd/undici/tree/main/packages/eleventy-plugin-permissions-policy) | [![npm version](https://badge.fury.io/js/@jackdbd%2Feleventy-plugin-permissions-policy.svg)](https://badge.fury.io/js/@jackdbd%2Feleventy-plugin-permissions-policy) | [![install size](https://packagephobia.com/badge?p=@jackdbd/eleventy-plugin-permissions-policy)](https://packagephobia.com/result?p=@jackdbd/eleventy-plugin-permissions-policy) | [Coverage](https://app.codecov.io/gh/jackdbd/undici?flags%5B0%5D=eleventy-plugin-permissions-policy) | [Docs](https://jackdbd.github.io/undici/eleventy-plugin-permissions-policy/index.html) | | [@jackdbd/eleventy-plugin-plausible](https://github.com/jackdbd/undici/tree/main/packages/eleventy-plugin-plausible) | [![npm version](https://badge.fury.io/js/@jackdbd%2Feleventy-plugin-plausible.svg)](https://badge.fury.io/js/@jackdbd%2Feleventy-plugin-plausible) | [![install size](https://packagephobia.com/badge?p=@jackdbd/eleventy-plugin-plausible)](https://packagephobia.com/result?p=@jackdbd/eleventy-plugin-plausible) | [Coverage](https://app.codecov.io/gh/jackdbd/undici?flags%5B0%5D=eleventy-plugin-plausible) | [Docs](https://jackdbd.github.io/undici/eleventy-plugin-plausible/index.html) | | [@jackdbd/eleventy-plugin-telegram](https://github.com/jackdbd/undici/tree/main/packages/eleventy-plugin-telegram) | [![npm version](https://badge.fury.io/js/@jackdbd%2Feleventy-plugin-telegram.svg)](https://badge.fury.io/js/@jackdbd%2Feleventy-plugin-telegram) | [![install size](https://packagephobia.com/badge?p=@jackdbd/eleventy-plugin-telegram)](https://packagephobia.com/result?p=@jackdbd/eleventy-plugin-telegram) | [Coverage](https://app.codecov.io/gh/jackdbd/undici?flags%5B0%5D=eleventy-plugin-telegram) | [Docs](https://jackdbd.github.io/undici/eleventy-plugin-telegram/index.html) | | [@jackdbd/eleventy-plugin-text-to-speech](https://github.com/jackdbd/undici/tree/main/packages/eleventy-plugin-text-to-speech) | [![npm version](https://badge.fury.io/js/@jackdbd%2Feleventy-plugin-text-to-speech.svg)](https://badge.fury.io/js/@jackdbd%2Feleventy-plugin-text-to-speech) | [![install size](https://packagephobia.com/badge?p=@jackdbd/eleventy-plugin-text-to-speech)](https://packagephobia.com/result?p=@jackdbd/eleventy-plugin-text-to-speech) | [Coverage](https://app.codecov.io/gh/jackdbd/undici?flags%5B0%5D=eleventy-plugin-text-to-speech) | [Docs](https://jackdbd.github.io/undici/eleventy-plugin-text-to-speech/index.html) | | [@jackdbd/hosting-utils](https://github.com/jackdbd/undici/tree/main/packages/hosting-utils) | [![npm version](https://badge.fury.io/js/@jackdbd%2Fhosting-utils.svg)](https://badge.fury.io/js/@jackdbd%2Fhosting-utils) | [![install size](https://packagephobia.com/badge?p=@jackdbd/hosting-utils)](https://packagephobia.com/result?p=@jackdbd/hosting-utils) | [Coverage](https://app.codecov.io/gh/jackdbd/undici?flags%5B0%5D=hosting-utils) | [Docs](https://jackdbd.github.io/undici/hosting-utils/index.html) | +| [@jackdbd/permissions-policy](https://github.com/jackdbd/undici/tree/main/packages/permissions-policy) | [![npm version](https://badge.fury.io/js/@jackdbd%2Fpermissions-policy.svg)](https://badge.fury.io/js/@jackdbd%2Fpermissions-policy) | [![install size](https://packagephobia.com/badge?p=@jackdbd/permissions-policy)](https://packagephobia.com/result?p=@jackdbd/permissions-policy) | [Coverage](https://app.codecov.io/gh/jackdbd/undici?flags%5B0%5D=permissions-policy) | [Docs](https://jackdbd.github.io/undici/permissions-policy/index.html) | > 📦 **ESM only:** > @@ -101,7 +101,7 @@ npx simple-git-hooks This monorepo uses [Typescript project references](https://www.typescriptlang.org/docs/handbook/project-references.html) to build all of its libraries. -This project has **47 dev dependencies**: [@11ty/eleventy](https://www.npmjs.com/package/@11ty/eleventy), [@11ty/eleventy-fetch](https://www.npmjs.com/package/@11ty/eleventy-fetch), [@aws-sdk/client-s3](https://www.npmjs.com/package/@aws-sdk/client-s3), [@aws-sdk/lib-storage](https://www.npmjs.com/package/@aws-sdk/lib-storage), [@commitlint/cli](https://www.npmjs.com/package/@commitlint/cli), [@commitlint/config-conventional](https://www.npmjs.com/package/@commitlint/config-conventional), [@google-cloud/storage](https://www.npmjs.com/package/@google-cloud/storage), [@google-cloud/text-to-speech](https://www.npmjs.com/package/@google-cloud/text-to-speech), [@jackdbd/checks](https://www.npmjs.com/package/@jackdbd/checks), [@jackdbd/zod-to-doc](https://www.npmjs.com/package/@jackdbd/zod-to-doc), [@microsoft/api-documenter](https://www.npmjs.com/package/@microsoft/api-documenter), [@microsoft/api-extractor](https://www.npmjs.com/package/@microsoft/api-extractor), [@qiwi/multi-semantic-release](https://www.npmjs.com/package/@qiwi/multi-semantic-release), [@semantic-release/changelog](https://www.npmjs.com/package/@semantic-release/changelog), [@semantic-release/exec](https://www.npmjs.com/package/@semantic-release/exec), [@semantic-release/git](https://www.npmjs.com/package/@semantic-release/git), [@thi.ng/transclude](https://www.npmjs.com/package/@thi.ng/transclude), [@types/debug](https://www.npmjs.com/package/@types/debug), [@types/html-to-text](https://www.npmjs.com/package/@types/html-to-text), [@types/jsdom](https://www.npmjs.com/package/@types/jsdom), [@types/yargs](https://www.npmjs.com/package/@types/yargs), [@typescript-eslint/eslint-plugin](https://www.npmjs.com/package/@typescript-eslint/eslint-plugin), [debug](https://www.npmjs.com/package/debug), [eslint](https://www.npmjs.com/package/eslint), [eslint-config-prettier](https://www.npmjs.com/package/eslint-config-prettier), [eslint-plugin-prettier](https://www.npmjs.com/package/eslint-plugin-prettier), [lint-staged](https://www.npmjs.com/package/lint-staged), [micromark](https://www.npmjs.com/package/micromark), [npm-run-all](https://www.npmjs.com/package/npm-run-all), [pkg-size](https://www.npmjs.com/package/pkg-size), [prettier](https://www.npmjs.com/package/prettier), [pretty-error](https://www.npmjs.com/package/pretty-error), [publint](https://www.npmjs.com/package/publint), [rimraf](https://www.npmjs.com/package/rimraf), [semantic-release](https://www.npmjs.com/package/semantic-release), [semantic-release-telegram](https://www.npmjs.com/package/semantic-release-telegram), [serve](https://www.npmjs.com/package/serve), [simple-git-hooks](https://www.npmjs.com/package/simple-git-hooks), [specificity](https://www.npmjs.com/package/specificity), [taze](https://www.npmjs.com/package/taze), [tsm](https://www.npmjs.com/package/tsm), [typedoc](https://www.npmjs.com/package/typedoc), [typedoc-plugin-zod](https://www.npmjs.com/package/typedoc-plugin-zod), [typescript](https://www.npmjs.com/package/typescript), [wrangler](https://www.npmjs.com/package/wrangler), [yargs](https://www.npmjs.com/package/yargs), [zx](https://www.npmjs.com/package/zx). +This project has **48 dev dependencies**: [@11ty/eleventy](https://www.npmjs.com/package/@11ty/eleventy), [@11ty/eleventy-fetch](https://www.npmjs.com/package/@11ty/eleventy-fetch), [@aws-sdk/client-s3](https://www.npmjs.com/package/@aws-sdk/client-s3), [@aws-sdk/lib-storage](https://www.npmjs.com/package/@aws-sdk/lib-storage), [@commitlint/cli](https://www.npmjs.com/package/@commitlint/cli), [@commitlint/config-conventional](https://www.npmjs.com/package/@commitlint/config-conventional), [@google-cloud/storage](https://www.npmjs.com/package/@google-cloud/storage), [@google-cloud/text-to-speech](https://www.npmjs.com/package/@google-cloud/text-to-speech), [@jackdbd/checks](https://www.npmjs.com/package/@jackdbd/checks), [@jackdbd/content-security-policy](https://www.npmjs.com/package/@jackdbd/content-security-policy), [@jackdbd/zod-to-doc](https://www.npmjs.com/package/@jackdbd/zod-to-doc), [@microsoft/api-documenter](https://www.npmjs.com/package/@microsoft/api-documenter), [@microsoft/api-extractor](https://www.npmjs.com/package/@microsoft/api-extractor), [@qiwi/multi-semantic-release](https://www.npmjs.com/package/@qiwi/multi-semantic-release), [@semantic-release/changelog](https://www.npmjs.com/package/@semantic-release/changelog), [@semantic-release/exec](https://www.npmjs.com/package/@semantic-release/exec), [@semantic-release/git](https://www.npmjs.com/package/@semantic-release/git), [@thi.ng/transclude](https://www.npmjs.com/package/@thi.ng/transclude), [@types/debug](https://www.npmjs.com/package/@types/debug), [@types/html-to-text](https://www.npmjs.com/package/@types/html-to-text), [@types/jsdom](https://www.npmjs.com/package/@types/jsdom), [@types/yargs](https://www.npmjs.com/package/@types/yargs), [@typescript-eslint/eslint-plugin](https://www.npmjs.com/package/@typescript-eslint/eslint-plugin), [debug](https://www.npmjs.com/package/debug), [eslint](https://www.npmjs.com/package/eslint), [eslint-config-prettier](https://www.npmjs.com/package/eslint-config-prettier), [eslint-plugin-prettier](https://www.npmjs.com/package/eslint-plugin-prettier), [lint-staged](https://www.npmjs.com/package/lint-staged), [micromark](https://www.npmjs.com/package/micromark), [npm-run-all](https://www.npmjs.com/package/npm-run-all), [pkg-size](https://www.npmjs.com/package/pkg-size), [prettier](https://www.npmjs.com/package/prettier), [pretty-error](https://www.npmjs.com/package/pretty-error), [publint](https://www.npmjs.com/package/publint), [rimraf](https://www.npmjs.com/package/rimraf), [semantic-release](https://www.npmjs.com/package/semantic-release), [semantic-release-telegram](https://www.npmjs.com/package/semantic-release-telegram), [serve](https://www.npmjs.com/package/serve), [simple-git-hooks](https://www.npmjs.com/package/simple-git-hooks), [specificity](https://www.npmjs.com/package/specificity), [taze](https://www.npmjs.com/package/taze), [tsm](https://www.npmjs.com/package/tsm), [typedoc](https://www.npmjs.com/package/typedoc), [typedoc-plugin-zod](https://www.npmjs.com/package/typedoc-plugin-zod), [typescript](https://www.npmjs.com/package/typescript), [wrangler](https://www.npmjs.com/package/wrangler), [yargs](https://www.npmjs.com/package/yargs), [zx](https://www.npmjs.com/package/zx). Build all libraries (i.e. 11ty plugins) in watch mode: diff --git a/assets/html-pages/eleventy-plugin-csp-config.json b/assets/html-pages/eleventy-plugin-csp-config.json deleted file mode 100644 index 03aca5ff..00000000 --- a/assets/html-pages/eleventy-plugin-csp-config.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "allowDeprecatedDirectives": true, - "directives": { - "base-uri": [ - "self" - ], - "default-src": [ - "none" - ], - "font-src": [ - "self" - ], - "img-src": [ - "self", - "github.com", - "raw.githubusercontent.com", - "res.cloudinary.com" - ], - "script-src-elem": [ - "self", - "https://plausible.io/js/plausible.js", - "https://static.cloudflareinsights.com/beacon.min.js", - "https://unpkg.com/htm/preact/standalone.module.js" - ], - "style-src-elem": [ - "self", - "sha256" - ], - "upgrade-insecure-requests": true, - "worker-src": [ - "self" - ] - }, - "globPatterns": [ - "/", - "/*/" - ], - "globPatternsDetach": [ - "/*.png" - ], - "excludePatterns": [], - "includePatterns": [ - "/**/**.html" - ], - "reportOnly": true -} \ No newline at end of file diff --git a/docs/README.md b/docs/README.md index 50530620..66e8a87d 100644 --- a/docs/README.md +++ b/docs/README.md @@ -4,10 +4,10 @@ The documentation for each package is automatically generated by [TypeDoc](https |---|---|---|---|---|---| | [@jackdbd/eleventy-plugin-content-security-policy](https://github.com/jackdbd/undici/tree/main/packages/eleventy-plugin-content-security-policy) | [![npm version](https://badge.fury.io/js/@jackdbd%2Feleventy-plugin-content-security-policy.svg)](https://badge.fury.io/js/@jackdbd%2Feleventy-plugin-content-security-policy) | [![install size](https://packagephobia.com/badge?p=@jackdbd/eleventy-plugin-content-security-policy)](https://packagephobia.com/result?p=@jackdbd/eleventy-plugin-content-security-policy) | [Docs](./eleventy-plugin-content-security-policy/index.html) | [![CodeCov badge](https://codecov.io/gh/jackdbd/eleventy-plugin-content-security-policy/graph/badge.svg?token=9jddzo5Dt3)](https://codecov.io/gh/jackdbd/eleventy-plugin-content-security-policy) | [![Socket Badge](https://socket.dev/api/badge/npm/package/@jackdbd/eleventy-plugin-content-security-policy)](https://socket.dev/npm/package/@jackdbd/eleventy-plugin-content-security-policy) | | [@jackdbd/eleventy-plugin-ensure-env-vars](https://github.com/jackdbd/undici/tree/main/packages/eleventy-plugin-ensure-env-vars) | [![npm version](https://badge.fury.io/js/@jackdbd%2Feleventy-plugin-ensure-env-vars.svg)](https://badge.fury.io/js/@jackdbd%2Feleventy-plugin-ensure-env-vars) | [![install size](https://packagephobia.com/badge?p=@jackdbd/eleventy-plugin-ensure-env-vars)](https://packagephobia.com/result?p=@jackdbd/eleventy-plugin-ensure-env-vars) | [Docs](./eleventy-plugin-ensure-env-vars/index.html) | [![CodeCov badge](https://codecov.io/gh/jackdbd/eleventy-plugin-ensure-env-vars/graph/badge.svg?token=9jddzo5Dt3)](https://codecov.io/gh/jackdbd/eleventy-plugin-ensure-env-vars) | [![Socket Badge](https://socket.dev/api/badge/npm/package/@jackdbd/eleventy-plugin-ensure-env-vars)](https://socket.dev/npm/package/@jackdbd/eleventy-plugin-ensure-env-vars) | -| [@jackdbd/eleventy-plugin-permissions-policy](https://github.com/jackdbd/undici/tree/main/packages/eleventy-plugin-permissions-policy) | [![npm version](https://badge.fury.io/js/@jackdbd%2Feleventy-plugin-permissions-policy.svg)](https://badge.fury.io/js/@jackdbd%2Feleventy-plugin-permissions-policy) | [![install size](https://packagephobia.com/badge?p=@jackdbd/eleventy-plugin-permissions-policy)](https://packagephobia.com/result?p=@jackdbd/eleventy-plugin-permissions-policy) | [Docs](./eleventy-plugin-permissions-policy/index.html) | [![CodeCov badge](https://codecov.io/gh/jackdbd/eleventy-plugin-permissions-policy/graph/badge.svg?token=9jddzo5Dt3)](https://codecov.io/gh/jackdbd/eleventy-plugin-permissions-policy) | [![Socket Badge](https://socket.dev/api/badge/npm/package/@jackdbd/eleventy-plugin-permissions-policy)](https://socket.dev/npm/package/@jackdbd/eleventy-plugin-permissions-policy) | | [@jackdbd/eleventy-plugin-plausible](https://github.com/jackdbd/undici/tree/main/packages/eleventy-plugin-plausible) | [![npm version](https://badge.fury.io/js/@jackdbd%2Feleventy-plugin-plausible.svg)](https://badge.fury.io/js/@jackdbd%2Feleventy-plugin-plausible) | [![install size](https://packagephobia.com/badge?p=@jackdbd/eleventy-plugin-plausible)](https://packagephobia.com/result?p=@jackdbd/eleventy-plugin-plausible) | [Docs](./eleventy-plugin-plausible/index.html) | [![CodeCov badge](https://codecov.io/gh/jackdbd/eleventy-plugin-plausible/graph/badge.svg?token=9jddzo5Dt3)](https://codecov.io/gh/jackdbd/eleventy-plugin-plausible) | [![Socket Badge](https://socket.dev/api/badge/npm/package/@jackdbd/eleventy-plugin-plausible)](https://socket.dev/npm/package/@jackdbd/eleventy-plugin-plausible) | | [@jackdbd/eleventy-plugin-telegram](https://github.com/jackdbd/undici/tree/main/packages/eleventy-plugin-telegram) | [![npm version](https://badge.fury.io/js/@jackdbd%2Feleventy-plugin-telegram.svg)](https://badge.fury.io/js/@jackdbd%2Feleventy-plugin-telegram) | [![install size](https://packagephobia.com/badge?p=@jackdbd/eleventy-plugin-telegram)](https://packagephobia.com/result?p=@jackdbd/eleventy-plugin-telegram) | [Docs](./eleventy-plugin-telegram/index.html) | [![CodeCov badge](https://codecov.io/gh/jackdbd/eleventy-plugin-telegram/graph/badge.svg?token=9jddzo5Dt3)](https://codecov.io/gh/jackdbd/eleventy-plugin-telegram) | [![Socket Badge](https://socket.dev/api/badge/npm/package/@jackdbd/eleventy-plugin-telegram)](https://socket.dev/npm/package/@jackdbd/eleventy-plugin-telegram) | | [@jackdbd/eleventy-plugin-text-to-speech](https://github.com/jackdbd/undici/tree/main/packages/eleventy-plugin-text-to-speech) | [![npm version](https://badge.fury.io/js/@jackdbd%2Feleventy-plugin-text-to-speech.svg)](https://badge.fury.io/js/@jackdbd%2Feleventy-plugin-text-to-speech) | [![install size](https://packagephobia.com/badge?p=@jackdbd/eleventy-plugin-text-to-speech)](https://packagephobia.com/result?p=@jackdbd/eleventy-plugin-text-to-speech) | [Docs](./eleventy-plugin-text-to-speech/index.html) | [![CodeCov badge](https://codecov.io/gh/jackdbd/eleventy-plugin-text-to-speech/graph/badge.svg?token=9jddzo5Dt3)](https://codecov.io/gh/jackdbd/eleventy-plugin-text-to-speech) | [![Socket Badge](https://socket.dev/api/badge/npm/package/@jackdbd/eleventy-plugin-text-to-speech)](https://socket.dev/npm/package/@jackdbd/eleventy-plugin-text-to-speech) | | [@jackdbd/hosting-utils](https://github.com/jackdbd/undici/tree/main/packages/hosting-utils) | [![npm version](https://badge.fury.io/js/@jackdbd%2Fhosting-utils.svg)](https://badge.fury.io/js/@jackdbd%2Fhosting-utils) | [![install size](https://packagephobia.com/badge?p=@jackdbd/hosting-utils)](https://packagephobia.com/result?p=@jackdbd/hosting-utils) | [Docs](./hosting-utils/index.html) | [![CodeCov badge](https://codecov.io/gh/jackdbd/hosting-utils/graph/badge.svg?token=9jddzo5Dt3)](https://codecov.io/gh/jackdbd/hosting-utils) | [![Socket Badge](https://socket.dev/api/badge/npm/package/@jackdbd/hosting-utils)](https://socket.dev/npm/package/@jackdbd/hosting-utils) | +| [@jackdbd/permissions-policy](https://github.com/jackdbd/undici/tree/main/packages/permissions-policy) | [![npm version](https://badge.fury.io/js/@jackdbd%2Fpermissions-policy.svg)](https://badge.fury.io/js/@jackdbd%2Fpermissions-policy) | [![install size](https://packagephobia.com/badge?p=@jackdbd/permissions-policy)](https://packagephobia.com/result?p=@jackdbd/permissions-policy) | [Docs](./permissions-policy/index.html) | [![CodeCov badge](https://codecov.io/gh/jackdbd/permissions-policy/graph/badge.svg?token=9jddzo5Dt3)](https://codecov.io/gh/jackdbd/permissions-policy) | [![Socket Badge](https://socket.dev/api/badge/npm/package/@jackdbd/permissions-policy)](https://socket.dev/npm/package/@jackdbd/permissions-policy) | 🤖 Page generated by running the [script](https://github.com/jackdbd/undici/tree/main/scripts/README.md) `docs-root.mjs` \ No newline at end of file diff --git a/docs/eleventy-plugin-content-security-policy/functions/contentSecurityPolicyPlugin.html b/docs/eleventy-plugin-content-security-policy/functions/contentSecurityPolicyPlugin.html index a0a2481f..549a4d34 100644 --- a/docs/eleventy-plugin-content-security-policy/functions/contentSecurityPolicyPlugin.html +++ b/docs/eleventy-plugin-content-security-policy/functions/contentSecurityPolicyPlugin.html @@ -7,4 +7,4 @@ Eleventy site).

https://developers.cloudflare.com/pages/platform/headers/ https://docs.netlify.com/routing/headers/

-

Parameters

Returns void

\ No newline at end of file +

Parameters

Returns void

\ No newline at end of file diff --git a/docs/eleventy-plugin-content-security-policy/index.html b/docs/eleventy-plugin-content-security-policy/index.html index dc5b677c..26343c29 100644 --- a/docs/eleventy-plugin-content-security-policy/index.html +++ b/docs/eleventy-plugin-content-security-policy/index.html @@ -14,26 +14,7 @@

Installation

npm install @jackdbd/eleventy-plugin-content-security-policy
 
-
-

:warning: Peer Dependencies

-

This package defines 2 peer dependencies.

-
- - - - - - - - - - - - - - - -
PeerVersion range
@11ty/eleventy>=2.0.0 or 3.0.0-alpha.6
debug>=4.0.0
+

Note: this library was tested on Node.js >=18. It might work on other Node.js versions though.

About

Hosting providers like Cloudflare Pages and Netlify allow to define custom response headers in a plain text file called _headers. This file must be placed in the publish directory of your site (e.g. usually _site for a Eleventy site).

This plugin allows you to define a Content-Security-Policy (CSP) or a Content-Security-Policy-Report-Only header in your Eleventy configuration file, and then it automatically writes those headers into your _headers file when you build your site.

Usage

In your Eleventy config file:

@@ -107,7 +88,7 @@ @jackdbd/hosting-utils -* +1.0.0-canary.1 zod @@ -118,5 +99,25 @@ ^3.1.0 +
+

:warning: Peer Dependencies

+

This package defines 2 peer dependencies.

+
+ + + + + + + + + + + + + + + +
PeerVersion range
@11ty/eleventy>=2.0.0 or 3.0.0-alpha.6
debug>=4.0.0

License

© 2022 - 2024 Giacomo Debidda // MIT License

\ No newline at end of file diff --git a/docs/eleventy-plugin-content-security-policy/interfaces/Options.html b/docs/eleventy-plugin-content-security-policy/interfaces/Options.html index 545c2ec1..d8752755 100644 --- a/docs/eleventy-plugin-content-security-policy/interfaces/Options.html +++ b/docs/eleventy-plugin-content-security-policy/interfaces/Options.html @@ -1,5 +1,5 @@ Options | @jackdbd/eleventy-plugin-content-security-policy

Plugin options.

-
interface Options {
    allowDeprecatedDirectives: boolean;
    directives: {
        base-uri?: string[];
        child-src?: string[];
        connect-src?: string[];
        default-src?: string[];
        font-src?: string[];
        form-action?: string[];
        frame-ancestors?: string[];
        frame-src?: string[];
        img-src?: string[];
        manifest-src?: string[];
        media-src?: string[];
        navigate-to?: string[];
        object-src?: string[];
        report-to?: string[];
        sandbox?: ("allow-downloads" | "allow-downloads-without-user-activation" | "allow-forms" | "allow-modals" | "allow-orientation-lock" | "allow-pointer-lock" | "allow-popups" | "allow-popups-to-escape-sandbox" | "allow-presentation" | "allow-same-origin" | "allow-scripts" | "allow-storage-access-by-user-activation" | "allow-top-navigation" | "allow-top-navigation-by-user-activation" | "allow-top-navigation-to-custom-protocol")[];
        script-src?: string[];
        script-src-attr?: string[];
        script-src-elem?: string[];
        source-values?: string[];
        style-src?: string[];
        style-src-attr?: string[];
        style-src-elem?: string[];
        upgrade-insecure-requests?: boolean;
        worker-src?: string[];
    };
    excludePatterns: string[];
    globPatterns: string[];
    globPatternsDetach: string[];
    hosting?: string;
    includePatterns: string[];
    jsonRecap: boolean;
    reportOnly: boolean;
}

Properties

interface Options {
    allowDeprecatedDirectives: boolean;
    directives: {
        base-uri?: string[];
        child-src?: string[];
        connect-src?: string[];
        default-src?: string[];
        font-src?: string[];
        form-action?: string[];
        frame-ancestors?: string[];
        frame-src?: string[];
        img-src?: string[];
        manifest-src?: string[];
        media-src?: string[];
        navigate-to?: string[];
        object-src?: string[];
        report-to?: string[];
        sandbox?: ("allow-downloads" | "allow-downloads-without-user-activation" | "allow-forms" | "allow-modals" | "allow-orientation-lock" | "allow-pointer-lock" | "allow-popups" | "allow-popups-to-escape-sandbox" | "allow-presentation" | "allow-same-origin" | "allow-scripts" | "allow-storage-access-by-user-activation" | "allow-top-navigation" | "allow-top-navigation-by-user-activation" | "allow-top-navigation-to-custom-protocol")[];
        script-src?: string[];
        script-src-attr?: string[];
        script-src-elem?: string[];
        source-values?: string[];
        style-src?: string[];
        style-src-attr?: string[];
        style-src-elem?: string[];
        upgrade-insecure-requests?: boolean;
        worker-src?: string[];
    };
    excludePatterns: string[];
    globPatterns: string[];
    globPatternsDetach: string[];
    hosting?: string;
    includePatterns: string[];
    jsonRecap: boolean;
    reportOnly: boolean;
}

Properties

allowDeprecatedDirectives: boolean = ...
directives: {
    base-uri?: string[];
    child-src?: string[];
    connect-src?: string[];
    default-src?: string[];
    font-src?: string[];
    form-action?: string[];
    frame-ancestors?: string[];
    frame-src?: string[];
    img-src?: string[];
    manifest-src?: string[];
    media-src?: string[];
    navigate-to?: string[];
    object-src?: string[];
    report-to?: string[];
    sandbox?: ("allow-downloads" | "allow-downloads-without-user-activation" | "allow-forms" | "allow-modals" | "allow-orientation-lock" | "allow-pointer-lock" | "allow-popups" | "allow-popups-to-escape-sandbox" | "allow-presentation" | "allow-same-origin" | "allow-scripts" | "allow-storage-access-by-user-activation" | "allow-top-navigation" | "allow-top-navigation-by-user-activation" | "allow-top-navigation-to-custom-protocol")[];
    script-src?: string[];
    script-src-attr?: string[];
    script-src-elem?: string[];
    source-values?: string[];
    style-src?: string[];
    style-src-attr?: string[];
    style-src-elem?: string[];
    upgrade-insecure-requests?: boolean;
    worker-src?: string[];
} = ...

Type declaration

  • Optional base-uri?: string[]
  • Optional child-src?: string[]
  • Optional connect-src?: string[]
  • Optional default-src?: string[]
  • Optional font-src?: string[]
  • Optional form-action?: string[]
  • Optional frame-ancestors?: string[]
  • Optional frame-src?: string[]
  • Optional img-src?: string[]
  • Optional manifest-src?: string[]
  • Optional media-src?: string[]
  • Optional navigate-to?: string[]
  • Optional object-src?: string[]
  • Optional report-to?: string[]
  • Optional sandbox?: ("allow-downloads" | "allow-downloads-without-user-activation" | "allow-forms" | "allow-modals" | "allow-orientation-lock" | "allow-pointer-lock" | "allow-popups" | "allow-popups-to-escape-sandbox" | "allow-presentation" | "allow-same-origin" | "allow-scripts" | "allow-storage-access-by-user-activation" | "allow-top-navigation" | "allow-top-navigation-by-user-activation" | "allow-top-navigation-to-custom-protocol")[]
  • Optional script-src?: string[]
  • Optional script-src-attr?: string[]
  • Optional script-src-elem?: string[]
  • Optional source-values?: string[]
  • Optional style-src?: string[]
  • Optional style-src-attr?: string[]
  • Optional style-src-elem?: string[]
  • Optional upgrade-insecure-requests?: boolean
  • Optional worker-src?: string[]
excludePatterns: string[] = ...
globPatterns: string[] = ...
globPatternsDetach: string[] = ...
hosting?: string = ...
includePatterns: string[] = ...
jsonRecap: boolean = ...
reportOnly: boolean = ...
\ No newline at end of file +

Properties

allowDeprecatedDirectives: boolean = ...
directives: {
    base-uri?: string[];
    child-src?: string[];
    connect-src?: string[];
    default-src?: string[];
    font-src?: string[];
    form-action?: string[];
    frame-ancestors?: string[];
    frame-src?: string[];
    img-src?: string[];
    manifest-src?: string[];
    media-src?: string[];
    navigate-to?: string[];
    object-src?: string[];
    report-to?: string[];
    sandbox?: ("allow-downloads" | "allow-downloads-without-user-activation" | "allow-forms" | "allow-modals" | "allow-orientation-lock" | "allow-pointer-lock" | "allow-popups" | "allow-popups-to-escape-sandbox" | "allow-presentation" | "allow-same-origin" | "allow-scripts" | "allow-storage-access-by-user-activation" | "allow-top-navigation" | "allow-top-navigation-by-user-activation" | "allow-top-navigation-to-custom-protocol")[];
    script-src?: string[];
    script-src-attr?: string[];
    script-src-elem?: string[];
    source-values?: string[];
    style-src?: string[];
    style-src-attr?: string[];
    style-src-elem?: string[];
    upgrade-insecure-requests?: boolean;
    worker-src?: string[];
} = ...

Type declaration

  • Optional base-uri?: string[]
  • Optional child-src?: string[]
  • Optional connect-src?: string[]
  • Optional default-src?: string[]
  • Optional font-src?: string[]
  • Optional form-action?: string[]
  • Optional frame-ancestors?: string[]
  • Optional frame-src?: string[]
  • Optional img-src?: string[]
  • Optional manifest-src?: string[]
  • Optional media-src?: string[]
  • Optional navigate-to?: string[]
  • Optional object-src?: string[]
  • Optional report-to?: string[]
  • Optional sandbox?: ("allow-downloads" | "allow-downloads-without-user-activation" | "allow-forms" | "allow-modals" | "allow-orientation-lock" | "allow-pointer-lock" | "allow-popups" | "allow-popups-to-escape-sandbox" | "allow-presentation" | "allow-same-origin" | "allow-scripts" | "allow-storage-access-by-user-activation" | "allow-top-navigation" | "allow-top-navigation-by-user-activation" | "allow-top-navigation-to-custom-protocol")[]
  • Optional script-src?: string[]
  • Optional script-src-attr?: string[]
  • Optional script-src-elem?: string[]
  • Optional source-values?: string[]
  • Optional style-src?: string[]
  • Optional style-src-attr?: string[]
  • Optional style-src-elem?: string[]
  • Optional upgrade-insecure-requests?: boolean
  • Optional worker-src?: string[]
excludePatterns: string[] = ...
globPatterns: string[] = ...
globPatternsDetach: string[] = ...
hosting?: string = ...
includePatterns: string[] = ...
jsonRecap: boolean = ...
reportOnly: boolean = ...
\ No newline at end of file diff --git a/docs/eleventy-plugin-content-security-policy/variables/DEFAULT_OPTIONS.html b/docs/eleventy-plugin-content-security-policy/variables/DEFAULT_OPTIONS.html index 382796a5..d59990ec 100644 --- a/docs/eleventy-plugin-content-security-policy/variables/DEFAULT_OPTIONS.html +++ b/docs/eleventy-plugin-content-security-policy/variables/DEFAULT_OPTIONS.html @@ -1,2 +1,2 @@ DEFAULT_OPTIONS | @jackdbd/eleventy-plugin-content-security-policy
DEFAULT_OPTIONS: {
    allowDeprecatedDirectives: boolean;
    directives: any;
    excludePatterns: never[];
    globPatterns: string[];
    globPatternsDetach: never[];
    hosting: undefined | string;
    includePatterns: string[];
    jsonRecap: boolean;
    reportOnly: boolean;
} = ...

Default options for the plugin.

-

Type declaration

  • allowDeprecatedDirectives: boolean
  • directives: any
  • excludePatterns: never[]
  • globPatterns: string[]
  • globPatternsDetach: never[]
  • hosting: undefined | string
  • includePatterns: string[]
  • jsonRecap: boolean
  • reportOnly: boolean
\ No newline at end of file +

Type declaration

\ No newline at end of file diff --git a/docs/eleventy-plugin-ensure-env-vars/functions/ensureEnvVarsPlugin.html b/docs/eleventy-plugin-ensure-env-vars/functions/ensureEnvVarsPlugin.html index a7cc4f18..e388d77d 100644 --- a/docs/eleventy-plugin-ensure-env-vars/functions/ensureEnvVarsPlugin.html +++ b/docs/eleventy-plugin-ensure-env-vars/functions/ensureEnvVarsPlugin.html @@ -2,4 +2,4 @@ when Eleventy builds your site.

Parameters

Returns void

\ No newline at end of file +

Returns void

\ No newline at end of file diff --git a/docs/eleventy-plugin-ensure-env-vars/index.html b/docs/eleventy-plugin-ensure-env-vars/index.html index 919d33be..aa3ac359 100644 --- a/docs/eleventy-plugin-ensure-env-vars/index.html +++ b/docs/eleventy-plugin-ensure-env-vars/index.html @@ -16,26 +16,7 @@

Installation

npm install @jackdbd/eleventy-plugin-ensure-env-vars
 
-
-

:warning: Peer Dependencies

-

This package defines 2 peer dependencies.

-
- - - - - - - - - - - - - - - -
PeerVersion range
@11ty/eleventy>=2.0.0 or 3.0.0-alpha.6
debug>=4.0.0
+

Note: this library was tested on Node.js >=18. It might work on other Node.js versions though.

Usage

In your Eleventy config file:

import { ensureEnvVarsPlugin } from '@jackdbd/eleventy-plugin-ensure-env-vars'

export default function (eleventyConfig) {
// some eleventy configuration...

eleventyConfig.addPlugin(ensureEnvVarsPlugin, {
envVars: ['DEBUG', 'NODE_ENV']
})

// some more eleventy configuration...
}
@@ -74,5 +55,25 @@ ^3.1.0 +
+

:warning: Peer Dependencies

+

This package defines 2 peer dependencies.

+
+ + + + + + + + + + + + + + + +
PeerVersion range
@11ty/eleventy>=2.0.0 or 3.0.0-alpha.6
debug>=4.0.0

License

© 2022 - 2024 Giacomo Debidda // MIT License

\ No newline at end of file diff --git a/docs/eleventy-plugin-ensure-env-vars/interfaces/EleventyConfig.html b/docs/eleventy-plugin-ensure-env-vars/interfaces/EleventyConfig.html index 613ed1e7..efbd0a18 100644 --- a/docs/eleventy-plugin-ensure-env-vars/interfaces/EleventyConfig.html +++ b/docs/eleventy-plugin-ensure-env-vars/interfaces/EleventyConfig.html @@ -1,8 +1,8 @@ -EleventyConfig | @jackdbd/eleventy-plugin-ensure-env-vars
interface EleventyConfig {
    userConfig: any;
    verbose: boolean;
    addCollection(collectionName, fn): void;
    addGlobalData(dataKey, fn): void;
    addPlugin(pluginFn, pluginOptions): void;
    addTransform(transformName, fn): void;
    on(eventName, fn): void | Promise<void>;
}

Properties

userConfig +EleventyConfig | @jackdbd/eleventy-plugin-ensure-env-vars
interface EleventyConfig {
    userConfig: any;
    verbose: boolean;
    addCollection(collectionName, fn): void;
    addGlobalData(dataKey, fn): void;
    addPlugin(pluginFn, pluginOptions): void;
    addTransform(transformName, fn): void;
    on(eventName, fn): void | Promise<void>;
}

Properties

userConfig: any
verbose: boolean

Methods

\ No newline at end of file +

Properties

userConfig: any
verbose: boolean

Methods

\ No newline at end of file diff --git a/docs/eleventy-plugin-ensure-env-vars/interfaces/Options.html b/docs/eleventy-plugin-ensure-env-vars/interfaces/Options.html index 95ce12cd..f31c6d7c 100644 --- a/docs/eleventy-plugin-ensure-env-vars/interfaces/Options.html +++ b/docs/eleventy-plugin-ensure-env-vars/interfaces/Options.html @@ -1,4 +1,4 @@ Options | @jackdbd/eleventy-plugin-ensure-env-vars

Plugin options.

-
interface Options {
    envVars: string[];
}

Properties

interface Options {
    envVars: string[];
}

Properties

Properties

envVars: string[] = ...

Environment variables you want to ensure are set when building your Eleventy site.

-
\ No newline at end of file +
\ No newline at end of file diff --git a/docs/eleventy-plugin-ensure-env-vars/variables/env_var.html b/docs/eleventy-plugin-ensure-env-vars/variables/env_var.html index 3ee7a96f..5d5cf562 100644 --- a/docs/eleventy-plugin-ensure-env-vars/variables/env_var.html +++ b/docs/eleventy-plugin-ensure-env-vars/variables/env_var.html @@ -4,4 +4,4 @@

See

-
\ No newline at end of file +
\ No newline at end of file diff --git a/docs/eleventy-plugin-permissions-policy/assets/navigation.js b/docs/eleventy-plugin-permissions-policy/assets/navigation.js deleted file mode 100644 index acaf1eb6..00000000 --- a/docs/eleventy-plugin-permissions-policy/assets/navigation.js +++ /dev/null @@ -1 +0,0 @@ -window.navigationData = "data:application/octet-stream;base64,H4sIAAAAAAAAA4uuVipJrShRslJyySxKTS7JLEtV0lEqSCzJAAqVVBakFuvDJfQySnJzgLLZmXkpSlZGBpbmhqZGtTpwE/wLSjLz84rR9UOFCel2cXVzDPUJifcPCPH09wtGmFKWWJSZmJQDcgmqElQTjZENS8H0DMIYuKSuIR4j0lITS0qLsBoAlcKrPR89MBDaoVJ4tRekFuVmFheD1AXk52QmVwbklKZn5iGMSyvNSwYbo49DKarhZia1sQCTR5sS7AEAAA==" \ No newline at end of file diff --git a/docs/eleventy-plugin-permissions-policy/assets/search.js b/docs/eleventy-plugin-permissions-policy/assets/search.js deleted file mode 100644 index 5144209f..00000000 --- a/docs/eleventy-plugin-permissions-policy/assets/search.js +++ /dev/null @@ -1 +0,0 @@ -window.searchData = "data:application/octet-stream;base64,H4sIAAAAAAAAA61Y246bMBD9F/eVZRlzz1uldqWVqm7UbvsSRRENzi4tAQRkL4ry7zXgYDuxE8jmJZHjc86M55gZlC0q89cKTWZb9C/JYjTxHANl0ZqgCSpIuU6qKsmzapqnyfJ9mm6ekgwZaFOmdH+1yZZ1s3urQZrP9Tql8GUaVRWhURDaGftANu4Dffl69/nXt8fFw/Tx/uH7zz7AS1Qm0Z+UVLcHiJPCnuvaXq+9WNTvBRko+alHC8oGKqKSZLUiUR4ULMwLFycloZV5ofxRcU2JOCgFk2WsyYS8LdNNTKZRXZMyG5vOMfsaOT3nVZ1kTyNz4axr5JBk7cnuSFRvStLd2ZEJaSSumN2Frh2zr5HT3yrPfpBlVIzMRuRdmIfQKfoHRJFFv3cDQxvPqjNPIcZ2hkvlRdsKFVJs54wUtkIfXKEnHp20qQqt9f73y3vgOo83NDF9x9NcgcNqKXRMjlGbffqSRWmav6ZJVZ+MIaIGRjms7sOBW11t2a9XrewNDKqtYmQoxYaMiMtGgjrc0BEwruWrY51r8R9o6eqAo1r4ZS37ZOAPVvW4JaujnW/B+zhzgx4kJm9oskUvpGxe6OguNm0zpPBVQtK4eVfsEqBi+XrdCMzZ3m96M/OyQXSQWwsZM8vAgQm2M58bsz2j3Wh/aGH0EZmBCgYSDNMVNiA0PQ8kGJZgNl3ZBrZNC3sSzJZgDl05KpgjwVy6clUwV4J5dOWpYJ4E8+nKV8F8CRbQVaCCBRKMmjILVbBQLm9TbbBUQDgwonUClEjZC8C62CC7AbbONZD9AEefpWwJNKUHrLwwsivg6c8jGwO+Nk3ZGgh01wtkcyDUXTCQ7cGW7oph2R0MukuGDx4UrLtmWDYH27qLhjtz2oZAO0FN4vuuMdBHez/0tmjBukU/WLcI04+dgai53bfffO94r2hWTSBhiHMdEISolWpmTFbRJq0X/RuXwBfoOjZ/r+K8kPNCljc+x5cC21xgf/BAI8AmatH3fq7icBWHqYQalf49Szi8JZzeYnxHw+9nLee7nO52bGxp2Gx+sSQKNji5lMelPCal84NJqcrhcxWfqehcaUZc2Y04zg84P2B8W8NX3SXxMgErp6fhC3+AdNUo2F8lXE9wR1lW+qgVSUHSJKOY2Xy3+w/yXtylmxEAAA=="; \ No newline at end of file diff --git a/docs/eleventy-plugin-permissions-policy/functions/permissionsPolicyPlugin.html b/docs/eleventy-plugin-permissions-policy/functions/permissionsPolicyPlugin.html deleted file mode 100644 index df3437d0..00000000 --- a/docs/eleventy-plugin-permissions-policy/functions/permissionsPolicyPlugin.html +++ /dev/null @@ -1,5 +0,0 @@ -permissionsPolicyPlugin | @jackdbd/eleventy-plugin-permissions-policy
  • Plugin configuration function.

    -

    Parameters

    • eleventyConfig: EleventyConfig
    • options: {
          directives?: {
              allowlist?: string[];
              feature: "accelerometer" | "ambient-light-sensor" | "autoplay" | "battery" | "browsing-topics" | "camera" | "clipboard-read" | "clipboard-write" | "conversion-measurement" | "cross-origin-isolated" | "display-capture" | "document-domain" | "encrypted-media" | "execution-while-not-rendered" | "execution-while-out-of-viewport" | "focus-without-user-activation" | "fullscreen" | "gamepad" | "geolocation" | "gyroscope" | "hid" | "idle-detection" | "layout-animations" | "legacy-image-formats" | "magnetometer" | "microphone" | "midi" | "navigation-override" | "oversized-images" | "payment" | "picture-in-picture" | "publickey-credentials-get" | "screen-wake-lock" | "serial" | "speaker-selection" | "sync-script" | "sync-xhr" | "trust-token-redemption" | "unload" | "unoptimized-images" | "unsized-media" | "usb" | "vertical-scroll" | "web-share" | "window-placement" | "xr-spatial-tracking";
          }[];
          excludePatterns?: string[];
          hosting?: string;
          includeFeaturePolicy?: boolean;
          includePatterns?: string[];
          jsonRecap?: boolean;
      }
      • Optional directives?: {
            allowlist?: string[];
            feature: "accelerometer" | "ambient-light-sensor" | "autoplay" | "battery" | "browsing-topics" | "camera" | "clipboard-read" | "clipboard-write" | "conversion-measurement" | "cross-origin-isolated" | "display-capture" | "document-domain" | "encrypted-media" | "execution-while-not-rendered" | "execution-while-out-of-viewport" | "focus-without-user-activation" | "fullscreen" | "gamepad" | "geolocation" | "gyroscope" | "hid" | "idle-detection" | "layout-animations" | "legacy-image-formats" | "magnetometer" | "microphone" | "midi" | "navigation-override" | "oversized-images" | "payment" | "picture-in-picture" | "publickey-credentials-get" | "screen-wake-lock" | "serial" | "speaker-selection" | "sync-script" | "sync-xhr" | "trust-token-redemption" | "unload" | "unoptimized-images" | "unsized-media" | "usb" | "vertical-scroll" | "web-share" | "window-placement" | "xr-spatial-tracking";
        }[]

        Array of unique Permissions-Policy directives.

        -
      • Optional excludePatterns?: string[]
      • Optional hosting?: string
      • Optional includeFeaturePolicy?: boolean

        Whether to include the Feature-Policy header or not.

        -
      • Optional includePatterns?: string[]
      • Optional jsonRecap?: boolean

        Whether to generate a JSON file (useful for troubleshooting).

        -

    Returns void

\ No newline at end of file diff --git a/docs/eleventy-plugin-permissions-policy/index.html b/docs/eleventy-plugin-permissions-policy/index.html deleted file mode 100644 index b10b8a84..00000000 --- a/docs/eleventy-plugin-permissions-policy/index.html +++ /dev/null @@ -1,145 +0,0 @@ -@jackdbd/eleventy-plugin-permissions-policy

@jackdbd/eleventy-plugin-permissions-policy

@jackdbd/eleventy-plugin-permissions-policy

npm version -install size -CodeCov badge -Socket Badge

-

Eleventy plugin that writes Permissions-Policy and Feature-Policy headers to a _headers file when Eleventy builds your site.

- -

Installation

npm install @jackdbd/eleventy-plugin-permissions-policy
-
-
-

:warning: Peer Dependencies

-

This package defines 2 peer dependencies.

-
- - - - - - - - - - - - - - - -
PeerVersion range
@11ty/eleventy>=2.0.0 or 3.0.0-alpha.6
debug>=4.0.0
-

About

Hosting providers like Cloudflare Pages and Netlify allow to define custom response headers in a plain text file called _headers. This file must be placed in the publish directory of your site (e.g. usually _site for a Eleventy site).

-

This plugin allows you to define a Permissions-Policy or a Feature-Policy header in your Eleventy configuration file, and then it automatically writes those headers into your _headers file when you build your site.

-

Docs

Docs generated by TypeDoc

-
-

:open_book: API Docs

-

This project uses API Extractor and api-documenter markdown to generate a bunch of markdown files and a .d.ts rollup file containing all type definitions consolidated into a single file. I don't find this .d.ts rollup file particularly useful. On the other hand, the markdown files that api-documenter generates are quite handy when reviewing the public API of this project.

-

See Generating API docs if you want to know more.

-
-

Usage

In your Eleventy config file:

-
import { permissionsPolicyPlugin } from '@jackdbd/eleventy-plugin-permissions-policy'

export default function (eleventyConfig) {
// some eleventy configuration...

eleventyConfig.addPlugin(permissionsPolicyPlugin, {
directives: [
{ feature: 'autoplay', allowlist: ['*'] },
{ feature: 'geolocation', allowlist: ['self'] },
{ feature: 'camera', allowlist: ['self', 'https://trusted-site.example'] },
{ feature: 'fullscreen', allowlist: [] }
],
includeFeaturePolicy: true
})

// some more eleventy configuration...
} -
-

Configuration

Read these resources to understand how to configure the Permissions-Policy and the Feature-Policy HTTP response headers.

- -

Plugin options

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
KeyDefaultDescription
directivesundefinedPermissions-Policy directives.
excludePatternsundefinedFiles that match these patterns will not be served with the Permissions-Policy header (nor with the Feature-Policy header, if generated).
hostingundefined
includeFeaturePolicyundefinedWhether to generate also a Feature-Policy header.
includePatternsundefinedFiles that match these patterns will be served with the Permissions-Policy header (and also with the Feature-Policy header, if generated).
jsonRecapundefined
-

Permissions-Policy directive

- - - - - - - - - - - - - - - - - -
KeyDefaultDescription
allowlistundefinedA set of origins and/or special values (*, none, self, src).
featureundefinedA policy-controlled feature is an API or behaviour which can be enabled or disabled in a document by referring to it in a permissions policy.
-

Troubleshooting

This plugin uses the debug library for logging. -You can control what's logged using the DEBUG environment variable.

-

For example, if you set your environment variables in a .envrc file, you can do:

-
# print all logging statements
export DEBUG=11ty-plugin:* -
-

Dependencies

- - - - - - - - - - - - - - - - - - -
PackageVersion
@jackdbd/hosting-utils*
zod^3.23.0
zod-validation-error^3.1.0
-

License

© 2022 - 2024 Giacomo Debidda // MIT License

-
\ No newline at end of file diff --git a/docs/eleventy-plugin-permissions-policy/types/Directive.html b/docs/eleventy-plugin-permissions-policy/types/Directive.html deleted file mode 100644 index 3f851219..00000000 --- a/docs/eleventy-plugin-permissions-policy/types/Directive.html +++ /dev/null @@ -1 +0,0 @@ -Directive | @jackdbd/eleventy-plugin-permissions-policy
Directive: {
    allowlist?: string[];
    feature: "accelerometer" | "ambient-light-sensor" | "autoplay" | "battery" | "browsing-topics" | "camera" | "clipboard-read" | "clipboard-write" | "conversion-measurement" | "cross-origin-isolated" | "display-capture" | "document-domain" | "encrypted-media" | "execution-while-not-rendered" | "execution-while-out-of-viewport" | "focus-without-user-activation" | "fullscreen" | "gamepad" | "geolocation" | "gyroscope" | "hid" | "idle-detection" | "layout-animations" | "legacy-image-formats" | "magnetometer" | "microphone" | "midi" | "navigation-override" | "oversized-images" | "payment" | "picture-in-picture" | "publickey-credentials-get" | "screen-wake-lock" | "serial" | "speaker-selection" | "sync-script" | "sync-xhr" | "trust-token-redemption" | "unload" | "unoptimized-images" | "unsized-media" | "usb" | "vertical-scroll" | "web-share" | "window-placement" | "xr-spatial-tracking";
}

Type declaration

  • Optional allowlist?: string[]
  • feature: "accelerometer" | "ambient-light-sensor" | "autoplay" | "battery" | "browsing-topics" | "camera" | "clipboard-read" | "clipboard-write" | "conversion-measurement" | "cross-origin-isolated" | "display-capture" | "document-domain" | "encrypted-media" | "execution-while-not-rendered" | "execution-while-out-of-viewport" | "focus-without-user-activation" | "fullscreen" | "gamepad" | "geolocation" | "gyroscope" | "hid" | "idle-detection" | "layout-animations" | "legacy-image-formats" | "magnetometer" | "microphone" | "midi" | "navigation-override" | "oversized-images" | "payment" | "picture-in-picture" | "publickey-credentials-get" | "screen-wake-lock" | "serial" | "speaker-selection" | "sync-script" | "sync-xhr" | "trust-token-redemption" | "unload" | "unoptimized-images" | "unsized-media" | "usb" | "vertical-scroll" | "web-share" | "window-placement" | "xr-spatial-tracking"
\ No newline at end of file diff --git a/docs/eleventy-plugin-permissions-policy/types/Options.html b/docs/eleventy-plugin-permissions-policy/types/Options.html deleted file mode 100644 index 8d75e4fa..00000000 --- a/docs/eleventy-plugin-permissions-policy/types/Options.html +++ /dev/null @@ -1,5 +0,0 @@ -Options | @jackdbd/eleventy-plugin-permissions-policy
Options: {
    directives?: {
        allowlist?: string[];
        feature: "accelerometer" | "ambient-light-sensor" | "autoplay" | "battery" | "browsing-topics" | "camera" | "clipboard-read" | "clipboard-write" | "conversion-measurement" | "cross-origin-isolated" | "display-capture" | "document-domain" | "encrypted-media" | "execution-while-not-rendered" | "execution-while-out-of-viewport" | "focus-without-user-activation" | "fullscreen" | "gamepad" | "geolocation" | "gyroscope" | "hid" | "idle-detection" | "layout-animations" | "legacy-image-formats" | "magnetometer" | "microphone" | "midi" | "navigation-override" | "oversized-images" | "payment" | "picture-in-picture" | "publickey-credentials-get" | "screen-wake-lock" | "serial" | "speaker-selection" | "sync-script" | "sync-xhr" | "trust-token-redemption" | "unload" | "unoptimized-images" | "unsized-media" | "usb" | "vertical-scroll" | "web-share" | "window-placement" | "xr-spatial-tracking";
    }[];
    excludePatterns?: string[];
    hosting?: string;
    includeFeaturePolicy?: boolean;
    includePatterns?: string[];
    jsonRecap?: boolean;
}

Options for this Eleventy plugin.

-

Type declaration

  • Optional directives?: {
        allowlist?: string[];
        feature: "accelerometer" | "ambient-light-sensor" | "autoplay" | "battery" | "browsing-topics" | "camera" | "clipboard-read" | "clipboard-write" | "conversion-measurement" | "cross-origin-isolated" | "display-capture" | "document-domain" | "encrypted-media" | "execution-while-not-rendered" | "execution-while-out-of-viewport" | "focus-without-user-activation" | "fullscreen" | "gamepad" | "geolocation" | "gyroscope" | "hid" | "idle-detection" | "layout-animations" | "legacy-image-formats" | "magnetometer" | "microphone" | "midi" | "navigation-override" | "oversized-images" | "payment" | "picture-in-picture" | "publickey-credentials-get" | "screen-wake-lock" | "serial" | "speaker-selection" | "sync-script" | "sync-xhr" | "trust-token-redemption" | "unload" | "unoptimized-images" | "unsized-media" | "usb" | "vertical-scroll" | "web-share" | "window-placement" | "xr-spatial-tracking";
    }[]

    Array of unique Permissions-Policy directives.

    -
  • Optional excludePatterns?: string[]
  • Optional hosting?: string
  • Optional includeFeaturePolicy?: boolean

    Whether to include the Feature-Policy header or not.

    -
  • Optional includePatterns?: string[]
  • Optional jsonRecap?: boolean

    Whether to generate a JSON file (useful for troubleshooting).

    -
\ No newline at end of file diff --git a/docs/eleventy-plugin-permissions-policy/variables/DEFAULT_OPTIONS.html b/docs/eleventy-plugin-permissions-policy/variables/DEFAULT_OPTIONS.html deleted file mode 100644 index 7917822f..00000000 --- a/docs/eleventy-plugin-permissions-policy/variables/DEFAULT_OPTIONS.html +++ /dev/null @@ -1,2 +0,0 @@ -DEFAULT_OPTIONS | @jackdbd/eleventy-plugin-permissions-policy
DEFAULT_OPTIONS: {
    directives: {
        allowlist?: string[];
        feature: "accelerometer" | "ambient-light-sensor" | "autoplay" | "battery" | "browsing-topics" | "camera" | "clipboard-read" | "clipboard-write" | "conversion-measurement" | "cross-origin-isolated" | "display-capture" | "document-domain" | "encrypted-media" | "execution-while-not-rendered" | "execution-while-out-of-viewport" | "focus-without-user-activation" | "fullscreen" | "gamepad" | "geolocation" | "gyroscope" | "hid" | "idle-detection" | "layout-animations" | "legacy-image-formats" | "magnetometer" | "microphone" | "midi" | "navigation-override" | "oversized-images" | "payment" | "picture-in-picture" | "publickey-credentials-get" | "screen-wake-lock" | "serial" | "speaker-selection" | "sync-script" | "sync-xhr" | "trust-token-redemption" | "unload" | "unoptimized-images" | "unsized-media" | "usb" | "vertical-scroll" | "web-share" | "window-placement" | "xr-spatial-tracking";
    }[];
    excludePatterns: string[];
    hosting: undefined | string;
    includeFeaturePolicy: boolean;
    includePatterns: string[];
    jsonRecap: boolean;
} = ...

Default options for the plugin.

-

Type declaration

  • directives: {
        allowlist?: string[];
        feature: "accelerometer" | "ambient-light-sensor" | "autoplay" | "battery" | "browsing-topics" | "camera" | "clipboard-read" | "clipboard-write" | "conversion-measurement" | "cross-origin-isolated" | "display-capture" | "document-domain" | "encrypted-media" | "execution-while-not-rendered" | "execution-while-out-of-viewport" | "focus-without-user-activation" | "fullscreen" | "gamepad" | "geolocation" | "gyroscope" | "hid" | "idle-detection" | "layout-animations" | "legacy-image-formats" | "magnetometer" | "microphone" | "midi" | "navigation-override" | "oversized-images" | "payment" | "picture-in-picture" | "publickey-credentials-get" | "screen-wake-lock" | "serial" | "speaker-selection" | "sync-script" | "sync-xhr" | "trust-token-redemption" | "unload" | "unoptimized-images" | "unsized-media" | "usb" | "vertical-scroll" | "web-share" | "window-placement" | "xr-spatial-tracking";
    }[]
  • excludePatterns: string[]
  • hosting: undefined | string
  • includeFeaturePolicy: boolean
  • includePatterns: string[]
  • jsonRecap: boolean
\ No newline at end of file diff --git a/docs/eleventy-plugin-permissions-policy/variables/directive-1.html b/docs/eleventy-plugin-permissions-policy/variables/directive-1.html deleted file mode 100644 index 1dfc407c..00000000 --- a/docs/eleventy-plugin-permissions-policy/variables/directive-1.html +++ /dev/null @@ -1 +0,0 @@ -directive | @jackdbd/eleventy-plugin-permissions-policy
directive: ZodObject<Directive> = ...
\ No newline at end of file diff --git a/docs/eleventy-plugin-permissions-policy/variables/feature-1.html b/docs/eleventy-plugin-permissions-policy/variables/feature-1.html deleted file mode 100644 index 17bc0dc7..00000000 --- a/docs/eleventy-plugin-permissions-policy/variables/feature-1.html +++ /dev/null @@ -1,6 +0,0 @@ -feature | @jackdbd/eleventy-plugin-permissions-policy
feature: ZodUnion<[ZodLiteral<"accelerometer">, ZodLiteral<"ambient-light-sensor">, ZodLiteral<"autoplay">, ZodLiteral<"battery">, ZodLiteral<"browsing-topics">, ZodLiteral<"camera">, ZodLiteral<"clipboard-read">]> = ...

Directive available in the Permissions-Policy header.

-
\ No newline at end of file diff --git a/docs/eleventy-plugin-permissions-policy/variables/options-1.html b/docs/eleventy-plugin-permissions-policy/variables/options-1.html deleted file mode 100644 index 8054d6b4..00000000 --- a/docs/eleventy-plugin-permissions-policy/variables/options-1.html +++ /dev/null @@ -1,2 +0,0 @@ -options | @jackdbd/eleventy-plugin-permissions-policy
options: ZodObject<Options> = ...

Zod schema for the options of this Eleventy plugin.

-
\ No newline at end of file diff --git a/docs/eleventy-plugin-plausible/functions/plausiblePlugin.html b/docs/eleventy-plugin-plausible/functions/plausiblePlugin.html index d889df16..704cf0b1 100644 --- a/docs/eleventy-plugin-plausible/functions/plausiblePlugin.html +++ b/docs/eleventy-plugin-plausible/functions/plausiblePlugin.html @@ -1,2 +1,2 @@ plausiblePlugin | @jackdbd/eleventy-plugin-plausible
  • Plugin configuration function.

    -

    Parameters

    • eleventyConfig: EleventyConfig
    • options: {
          apiKey?: string;
          cacheDirectory?: string;
          cacheDuration?: string;
          cacheVerbose?: boolean;
          siteId?: string;
          statsBreakdownGlobalDataKey?: string;
          statsBreakdownLimit?: number;
          statsBreakdownMetrics?: string;
          statsBreakdownPeriod?: string;
      }
      • Optional apiKey?: string
      • Optional cacheDirectory?: string
      • Optional cacheDuration?: string
      • Optional cacheVerbose?: boolean
      • Optional siteId?: string
      • Optional statsBreakdownGlobalDataKey?: string
      • Optional statsBreakdownLimit?: number
      • Optional statsBreakdownMetrics?: string
      • Optional statsBreakdownPeriod?: string

    Returns void

\ No newline at end of file +

Parameters

Returns void

\ No newline at end of file diff --git a/docs/eleventy-plugin-plausible/index.html b/docs/eleventy-plugin-plausible/index.html index 88555b77..cc50c6eb 100644 --- a/docs/eleventy-plugin-plausible/index.html +++ b/docs/eleventy-plugin-plausible/index.html @@ -17,26 +17,7 @@

Installation

npm install @jackdbd/eleventy-plugin-plausible
 
-
-

:warning: Peer Dependencies

-

This package defines 2 peer dependencies.

-
- - - - - - - - - - - - - - - -
PeerVersion range
@11ty/eleventy>=2.0.0 or 3.0.0-alpha.6
debug>=4.0.0
+

Note: this library was tested on Node.js >=18. It might work on other Node.js versions though.

About

This plugin retrieves analytics data from the Plausible API, caches it, then makes it available using an Eleventy global data key of your choice.

Usage

Configure this plugin with your Plausible API key and site ID, and then the options for analytics and caching.

import { plausiblePlugin } from '@jackdbd/eleventy-plugin-plausible'

export default function (eleventyConfig) {
// some eleventy configuration...

eleventyConfig.addPlugin(plausiblePlugin, {
apiKey: 'YOUR-API-KEY',
siteId: 'YOUR-SITE-ID',
cacheDuration: '30m',
cacheVerbose: true,
statsBreakdownPeriod: '7d'
})

// some more eleventy configuration...
} @@ -126,5 +107,25 @@ ^3.1.0 +
+

:warning: Peer Dependencies

+

This package defines 2 peer dependencies.

+
+ + + + + + + + + + + + + + + +
PeerVersion range
@11ty/eleventy>=2.0.0 or 3.0.0-alpha.6
debug>=4.0.0

License

© 2022 - 2024 Giacomo Debidda // MIT License

\ No newline at end of file diff --git a/docs/eleventy-plugin-plausible/types/Options.html b/docs/eleventy-plugin-plausible/types/Options.html index 95d0a8e2..01e9266c 100644 --- a/docs/eleventy-plugin-plausible/types/Options.html +++ b/docs/eleventy-plugin-plausible/types/Options.html @@ -1 +1 @@ -Options | @jackdbd/eleventy-plugin-plausible
Options: {
    apiKey?: string;
    cacheDirectory?: string;
    cacheDuration?: string;
    cacheVerbose?: boolean;
    siteId?: string;
    statsBreakdownGlobalDataKey?: string;
    statsBreakdownLimit?: number;
    statsBreakdownMetrics?: string;
    statsBreakdownPeriod?: string;
}

Type declaration

  • Optional apiKey?: string
  • Optional cacheDirectory?: string
  • Optional cacheDuration?: string
  • Optional cacheVerbose?: boolean
  • Optional siteId?: string
  • Optional statsBreakdownGlobalDataKey?: string
  • Optional statsBreakdownLimit?: number
  • Optional statsBreakdownMetrics?: string
  • Optional statsBreakdownPeriod?: string
\ No newline at end of file +Options | @jackdbd/eleventy-plugin-plausible
Options: {
    apiKey?: string;
    cacheDirectory?: string;
    cacheDuration?: string;
    cacheVerbose?: boolean;
    siteId?: string;
    statsBreakdownGlobalDataKey?: string;
    statsBreakdownLimit?: number;
    statsBreakdownMetrics?: string;
    statsBreakdownPeriod?: string;
}

Type declaration

  • Optional apiKey?: string
  • Optional cacheDirectory?: string
  • Optional cacheDuration?: string
  • Optional cacheVerbose?: boolean
  • Optional siteId?: string
  • Optional statsBreakdownGlobalDataKey?: string
  • Optional statsBreakdownLimit?: number
  • Optional statsBreakdownMetrics?: string
  • Optional statsBreakdownPeriod?: string
\ No newline at end of file diff --git a/docs/eleventy-plugin-plausible/variables/DEFAULT_OPTIONS.html b/docs/eleventy-plugin-plausible/variables/DEFAULT_OPTIONS.html index ee883cc7..9ffb178b 100644 --- a/docs/eleventy-plugin-plausible/variables/DEFAULT_OPTIONS.html +++ b/docs/eleventy-plugin-plausible/variables/DEFAULT_OPTIONS.html @@ -1 +1 @@ -DEFAULT_OPTIONS | @jackdbd/eleventy-plugin-plausible
DEFAULT_OPTIONS: {
    cacheDirectory: string;
    cacheDuration: string;
    cacheVerbose: boolean;
    statsBreakdownGlobalDataKey: string;
    statsBreakdownLimit: number;
    statsBreakdownMetrics: string;
    statsBreakdownPeriod: string;
} = ...

Type declaration

  • cacheDirectory: string
  • cacheDuration: string
  • cacheVerbose: boolean
  • statsBreakdownGlobalDataKey: string
  • statsBreakdownLimit: number
  • statsBreakdownMetrics: string
  • statsBreakdownPeriod: string
\ No newline at end of file +DEFAULT_OPTIONS | @jackdbd/eleventy-plugin-plausible
DEFAULT_OPTIONS: {
    cacheDirectory: string;
    cacheDuration: string;
    cacheVerbose: boolean;
    statsBreakdownGlobalDataKey: string;
    statsBreakdownLimit: number;
    statsBreakdownMetrics: string;
    statsBreakdownPeriod: string;
} = ...

Type declaration

  • cacheDirectory: string
  • cacheDuration: string
  • cacheVerbose: boolean
  • statsBreakdownGlobalDataKey: string
  • statsBreakdownLimit: number
  • statsBreakdownMetrics: string
  • statsBreakdownPeriod: string
\ No newline at end of file diff --git a/docs/eleventy-plugin-plausible/variables/options-1.html b/docs/eleventy-plugin-plausible/variables/options-1.html index 78589fd5..779c729a 100644 --- a/docs/eleventy-plugin-plausible/variables/options-1.html +++ b/docs/eleventy-plugin-plausible/variables/options-1.html @@ -1 +1 @@ -options | @jackdbd/eleventy-plugin-plausible
options: ZodObject<Options> = ...
\ No newline at end of file +options | @jackdbd/eleventy-plugin-plausible
options: ZodObject<Options> = ...
\ No newline at end of file diff --git a/docs/eleventy-plugin-telegram/functions/telegramPlugin.html b/docs/eleventy-plugin-telegram/functions/telegramPlugin.html index ee544d74..3dd92f26 100644 --- a/docs/eleventy-plugin-telegram/functions/telegramPlugin.html +++ b/docs/eleventy-plugin-telegram/functions/telegramPlugin.html @@ -14,4 +14,4 @@

Returns void

Remarks

The Telegram sendMessage API allows text messages of 1-4096 characters (after entities parsing).

-
\ No newline at end of file +
\ No newline at end of file diff --git a/docs/eleventy-plugin-telegram/index.html b/docs/eleventy-plugin-telegram/index.html index 520d0afe..668c5d93 100644 --- a/docs/eleventy-plugin-telegram/index.html +++ b/docs/eleventy-plugin-telegram/index.html @@ -14,26 +14,7 @@

Installation

npm install @jackdbd/eleventy-plugin-telegram
 
-
-

:warning: Peer Dependencies

-

This package defines 2 peer dependencies.

-
- - - - - - - - - - - - - - - -
PeerVersion range
@11ty/eleventy>=2.0.0 or 3.0.0-alpha.6
debug>=4.0.0
+

Note: this library was tested on Node.js >=18. It might work on other Node.js versions though.

Usage

In your Eleventy config file:

import { telegramPlugin } from '@jackdbd/eleventy-plugin-telegram'

export default function (eleventyConfig) {
// some eleventy configuration...

eleventyConfig.addPlugin(telegramPlugin, {
chatId: 'YOUR_TELEGRAM_CHAT_ID', // or set process.env.TELEGRAM_CHAT_ID and leave this undefined
token: 'YOUR_TELEGRAM_BOT_TOKEN', // or set process.env.TELEGRAM_BOT_TOKEN and leave this undefined
textBeforeBuild: '⏱️ 11ty <b>started</b> building my website',
textAfterBuild: '🏁 11ty <b>finished</b> building my website'
})

// some more eleventy configuration...
}
@@ -102,5 +83,25 @@ ^3.1.0 +
+

:warning: Peer Dependencies

+

This package defines 2 peer dependencies.

+
+ + + + + + + + + + + + + + + +
PeerVersion range
@11ty/eleventy>=2.0.0 or 3.0.0-alpha.6
debug>=4.0.0

License

© 2022 - 2024 Giacomo Debidda // MIT License

\ No newline at end of file diff --git a/docs/eleventy-plugin-telegram/interfaces/EleventyConfig.html b/docs/eleventy-plugin-telegram/interfaces/EleventyConfig.html index ece046c1..96aeb0a4 100644 --- a/docs/eleventy-plugin-telegram/interfaces/EleventyConfig.html +++ b/docs/eleventy-plugin-telegram/interfaces/EleventyConfig.html @@ -1,8 +1,8 @@ -EleventyConfig | @jackdbd/eleventy-plugin-telegram
interface EleventyConfig {
    userConfig: any;
    verbose: boolean;
    addCollection(collectionName, fn): void;
    addGlobalData(dataKey, fn): void;
    addPlugin(pluginFn, pluginOptions): void;
    addTransform(transformName, fn): void;
    on(eventName, fn): void | Promise<void>;
}

Properties

userConfig +EleventyConfig | @jackdbd/eleventy-plugin-telegram
interface EleventyConfig {
    userConfig: any;
    verbose: boolean;
    addCollection(collectionName, fn): void;
    addGlobalData(dataKey, fn): void;
    addPlugin(pluginFn, pluginOptions): void;
    addTransform(transformName, fn): void;
    on(eventName, fn): void | Promise<void>;
}

Properties

userConfig: any
verbose: boolean

Methods

\ No newline at end of file +

Properties

userConfig: any
verbose: boolean

Methods

\ No newline at end of file diff --git a/docs/eleventy-plugin-telegram/interfaces/Options.html b/docs/eleventy-plugin-telegram/interfaces/Options.html index 9a41b22c..d5d40c98 100644 --- a/docs/eleventy-plugin-telegram/interfaces/Options.html +++ b/docs/eleventy-plugin-telegram/interfaces/Options.html @@ -1,16 +1,16 @@ Options | @jackdbd/eleventy-plugin-telegram

Plugin options.

-
interface Options {
    chatId?: string | number;
    textAfterBuild?: string;
    textBeforeBuild?: string;
    token?: string;
}

Properties

interface Options {
    chatId?: string | number;
    textAfterBuild?: string;
    textBeforeBuild?: string;
    token?: string;
}

Properties

chatId?: string | number = ...

Telegram chat ID.

Remarks

The Telegram chat ID is negative for a group chat, positive for a username chat.

-
textAfterBuild?: string = ...

Text message to send when Eleventy finishes building your site.

-
textBeforeBuild?: string = ...

Text message to send when Eleventy starts building your site.

-
token?: string = ...

Telegram bot token.

+
textAfterBuild?: string = ...

Text message to send when Eleventy finishes building your site.

+
textBeforeBuild?: string = ...

Text message to send when Eleventy starts building your site.

+
token?: string = ...

Telegram bot token.

Remarks

If you forgot the API token of a Telegram bot you created, you can retrieve it at any time using BotFather. Just go to:

BotFather > bot list > API token
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/docs/eleventy-plugin-text-to-speech/functions/defaultAudioInnerHTML.html b/docs/eleventy-plugin-text-to-speech/functions/defaultAudioInnerHTML.html index 11034e3c..edd59d37 100644 --- a/docs/eleventy-plugin-text-to-speech/functions/defaultAudioInnerHTML.html +++ b/docs/eleventy-plugin-text-to-speech/functions/defaultAudioInnerHTML.html @@ -1 +1 @@ -defaultAudioInnerHTML | @jackdbd/eleventy-plugin-text-to-speech
  • Parameters

    • hrefs: string[]

    Returns string

\ No newline at end of file +defaultAudioInnerHTML | @jackdbd/eleventy-plugin-text-to-speech
  • Parameters

    • hrefs: string[]

    Returns string

\ No newline at end of file diff --git a/docs/eleventy-plugin-text-to-speech/functions/mediaType.html b/docs/eleventy-plugin-text-to-speech/functions/mediaType.html index 7171aa23..d878b64e 100644 --- a/docs/eleventy-plugin-text-to-speech/functions/mediaType.html +++ b/docs/eleventy-plugin-text-to-speech/functions/mediaType.html @@ -4,4 +4,4 @@
  • wikipedia.org - Supported media types in various browsers
  • stackoverflow.com - HTML5 audio Browsers unable to decode wav file encoded with IMA ADPCM
  • -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/docs/eleventy-plugin-text-to-speech/functions/textToAudioAsset.html b/docs/eleventy-plugin-text-to-speech/functions/textToAudioAsset.html index 0ccdd03e..66d94ad3 100644 --- a/docs/eleventy-plugin-text-to-speech/functions/textToAudioAsset.html +++ b/docs/eleventy-plugin-text-to-speech/functions/textToAudioAsset.html @@ -1,3 +1,3 @@ textToAudioAsset | @jackdbd/eleventy-plugin-text-to-speech
    • Synthesizes some text into a readable stream representing the speech. Then it generates an audio asset from that speech.

      -

      Parameters

      • config: {
            hosting: {
                config: {} & {
                    [k: string]: unknown;
                };
                write: ((...args) => Promise<{
                    error?: undefined;
                    value: {
                        href: string;
                        message: string;
                    };
                } | {
                    error: Error;
                    value?: undefined;
                }>);
            };
            synthesis: {
                config: {} & {
                    [k: string]: unknown;
                };
                extension: string;
                synthesize: ((...args) => Promise<{
                    error?: undefined;
                    value: Readable;
                } | {
                    error: Error;
                    value?: undefined;
                }>);
            };
            text: string;
        }
        • hosting: {
              config: {} & {
                  [k: string]: unknown;
              };
              write: ((...args) => Promise<{
                  error?: undefined;
                  value: {
                      href: string;
                      message: string;
                  };
              } | {
                  error: Error;
                  value?: undefined;
              }>);
          }
          • config: {} & {
                [k: string]: unknown;
            }
          • write: ((...args) => Promise<{
                error?: undefined;
                value: {
                    href: string;
                    message: string;
                };
            } | {
                error: Error;
                value?: undefined;
            }>)
              • (...args): Promise<{
                    error?: undefined;
                    value: {
                        href: string;
                        message: string;
                    };
                } | {
                    error: Error;
                    value?: undefined;
                }>
              • Parameters

                • Rest ...args: unknown[]

                Returns Promise<{
                    error?: undefined;
                    value: {
                        href: string;
                        message: string;
                    };
                } | {
                    error: Error;
                    value?: undefined;
                }>

        • synthesis: {
              config: {} & {
                  [k: string]: unknown;
              };
              extension: string;
              synthesize: ((...args) => Promise<{
                  error?: undefined;
                  value: Readable;
              } | {
                  error: Error;
                  value?: undefined;
              }>);
          }
          • config: {} & {
                [k: string]: unknown;
            }
          • extension: string
          • synthesize: ((...args) => Promise<{
                error?: undefined;
                value: Readable;
            } | {
                error: Error;
                value?: undefined;
            }>)
              • (...args): Promise<{
                    error?: undefined;
                    value: Readable;
                } | {
                    error: Error;
                    value?: undefined;
                }>
              • Parameters

                • Rest ...args: [string, ...unknown[]]

                Returns Promise<{
                    error?: undefined;
                    value: Readable;
                } | {
                    error: Error;
                    value?: undefined;
                }>

        • text: string

      Returns Promise<{
          error: Error;
          value?: undefined;
      } | {
          error?: undefined;
          value: {
              href: string;
              message: string;
          };
      }>

    \ No newline at end of file +

    Parameters

    Returns Promise<{
        error: Error;
        value?: undefined;
    } | {
        error?: undefined;
        value: {
            href: string;
            message: string;
        };
    }>

    \ No newline at end of file diff --git a/docs/eleventy-plugin-text-to-speech/functions/textToSpeechPlugin.html b/docs/eleventy-plugin-text-to-speech/functions/textToSpeechPlugin.html index 3fefeabe..68499eda 100644 --- a/docs/eleventy-plugin-text-to-speech/functions/textToSpeechPlugin.html +++ b/docs/eleventy-plugin-text-to-speech/functions/textToSpeechPlugin.html @@ -7,4 +7,4 @@

    Remarks

    If you register this plugin more than once, you will need to use a different name every time (11ty would NOT throw an Error, but this plugin will not work as expected).

    -

    Returns void

    \ No newline at end of file +

    Returns void

    \ No newline at end of file diff --git a/docs/eleventy-plugin-text-to-speech/index.html b/docs/eleventy-plugin-text-to-speech/index.html index 698c689f..4a85394e 100644 --- a/docs/eleventy-plugin-text-to-speech/index.html +++ b/docs/eleventy-plugin-text-to-speech/index.html @@ -31,42 +31,7 @@

    Installation

    npm install @jackdbd/eleventy-plugin-text-to-speech
     
    -
    -

    :warning: Peer Dependencies

    -

    This package defines 6 peer dependencies.

    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    PeerVersion range
    @11ty/eleventy>=2.0.0 or 3.0.0-alpha.6
    @aws-sdk/client-s3>=3.0.0
    @aws-sdk/lib-storage>=3.0.0
    @google-cloud/storage>=7.0.0
    @google-cloud/text-to-speech>=5.0.0
    debug>=4.0.0
    +

    Note: this library was tested on Node.js >=18. It might work on other Node.js versions though.

    About

    Eleventy plugin that uses text-to-speech to generate audio assets for your website, then injects audio players in your HTML.

    To synthesize text into speech you can use:

    \ No newline at end of file diff --git a/docs/text-to-audio-asset/index.html b/docs/text-to-audio-asset/index.html index 248636cb..fdb9e55b 100644 --- a/docs/text-to-audio-asset/index.html +++ b/docs/text-to-audio-asset/index.html @@ -13,6 +13,29 @@

    Installation

    npm install @jackdbd/text-to-audio-asset
     
    +

    Note: this library was tested on Node.js >=18. It might work on other Node.js versions though.

    +

    Usage

    TODO

    +

    Troubleshooting

    This plugin uses the debug library for logging. +You can control what's logged using the DEBUG environment variable.

    +

    For example, if you set your environment variables in a .envrc file, you can do:

    +
    # print all logging statements
    export DEBUG=11ty-plugin:* +
    +

    Dependencies

    + + + + + + + + + + + + + + +
    PackageVersion
    zod^3.23.0
    zod-validation-error^3.1.0

    :warning: Peer Dependencies

    This package defines 6 peer dependencies.

    @@ -49,27 +72,5 @@ >=4.0.0 -

    Usage

    TODO

    -

    Troubleshooting

    This plugin uses the debug library for logging. -You can control what's logged using the DEBUG environment variable.

    -

    For example, if you set your environment variables in a .envrc file, you can do:

    -
    # print all logging statements
    export DEBUG=11ty-plugin:* -
    -

    Dependencies

    - - - - - - - - - - - - - - -
    PackageVersion
    zod^3.23.0
    zod-validation-error^3.1.0

    License

    © 2022 - 2024 Giacomo Debidda // MIT License

    \ No newline at end of file diff --git a/docs/text-to-audio-asset/types/Config.html b/docs/text-to-audio-asset/types/Config.html index 69d02c80..8998365d 100644 --- a/docs/text-to-audio-asset/types/Config.html +++ b/docs/text-to-audio-asset/types/Config.html @@ -1 +1 @@ -Config | @jackdbd/text-to-audio-asset
    Config: {
        hosting: {
            config: {} & {
                [k: string]: unknown;
            };
            write: ((...args) => Promise<{
                error?: undefined;
                value: {
                    href: string;
                    message: string;
                };
            } | {
                error: Error;
                value?: undefined;
            }>);
        };
        synthesis: {
            config: {} & {
                [k: string]: unknown;
            };
            extension: string;
            synthesize: ((...args) => Promise<{
                error?: undefined;
                value: Readable;
            } | {
                error: Error;
                value?: undefined;
            }>);
        };
        text: string;
    }

    Type declaration

    • hosting: {
          config: {} & {
              [k: string]: unknown;
          };
          write: ((...args) => Promise<{
              error?: undefined;
              value: {
                  href: string;
                  message: string;
              };
          } | {
              error: Error;
              value?: undefined;
          }>);
      }
      • config: {} & {
            [k: string]: unknown;
        }
      • write: ((...args) => Promise<{
            error?: undefined;
            value: {
                href: string;
                message: string;
            };
        } | {
            error: Error;
            value?: undefined;
        }>)
          • (...args): Promise<{
                error?: undefined;
                value: {
                    href: string;
                    message: string;
                };
            } | {
                error: Error;
                value?: undefined;
            }>
          • Parameters

            • Rest ...args: unknown[]

            Returns Promise<{
                error?: undefined;
                value: {
                    href: string;
                    message: string;
                };
            } | {
                error: Error;
                value?: undefined;
            }>

    • synthesis: {
          config: {} & {
              [k: string]: unknown;
          };
          extension: string;
          synthesize: ((...args) => Promise<{
              error?: undefined;
              value: Readable;
          } | {
              error: Error;
              value?: undefined;
          }>);
      }
      • config: {} & {
            [k: string]: unknown;
        }
      • extension: string
      • synthesize: ((...args) => Promise<{
            error?: undefined;
            value: Readable;
        } | {
            error: Error;
            value?: undefined;
        }>)
          • (...args): Promise<{
                error?: undefined;
                value: Readable;
            } | {
                error: Error;
                value?: undefined;
            }>
          • Parameters

            • Rest ...args: [string, ...unknown[]]

            Returns Promise<{
                error?: undefined;
                value: Readable;
            } | {
                error: Error;
                value?: undefined;
            }>

    • text: string
    \ No newline at end of file +Config | @jackdbd/text-to-audio-asset
    Config: {
        hosting: {
            config: {} & {
                [k: string]: unknown;
            };
            write: ((...args) => Promise<{
                error?: undefined;
                value: {
                    href: string;
                    message: string;
                };
            } | {
                error: Error;
                value?: undefined;
            }>);
        };
        synthesis: {
            config: {} & {
                [k: string]: unknown;
            };
            extension: string;
            synthesize: ((...args) => Promise<{
                error?: undefined;
                value: Readable;
            } | {
                error: Error;
                value?: undefined;
            }>);
        };
        text: string;
    }

    Type declaration

    • hosting: {
          config: {} & {
              [k: string]: unknown;
          };
          write: ((...args) => Promise<{
              error?: undefined;
              value: {
                  href: string;
                  message: string;
              };
          } | {
              error: Error;
              value?: undefined;
          }>);
      }
      • config: {} & {
            [k: string]: unknown;
        }
      • write: ((...args) => Promise<{
            error?: undefined;
            value: {
                href: string;
                message: string;
            };
        } | {
            error: Error;
            value?: undefined;
        }>)
          • (...args): Promise<{
                error?: undefined;
                value: {
                    href: string;
                    message: string;
                };
            } | {
                error: Error;
                value?: undefined;
            }>
          • Parameters

            • Rest ...args: unknown[]

            Returns Promise<{
                error?: undefined;
                value: {
                    href: string;
                    message: string;
                };
            } | {
                error: Error;
                value?: undefined;
            }>

    • synthesis: {
          config: {} & {
              [k: string]: unknown;
          };
          extension: string;
          synthesize: ((...args) => Promise<{
              error?: undefined;
              value: Readable;
          } | {
              error: Error;
              value?: undefined;
          }>);
      }
      • config: {} & {
            [k: string]: unknown;
        }
      • extension: string
      • synthesize: ((...args) => Promise<{
            error?: undefined;
            value: Readable;
        } | {
            error: Error;
            value?: undefined;
        }>)
          • (...args): Promise<{
                error?: undefined;
                value: Readable;
            } | {
                error: Error;
                value?: undefined;
            }>
          • Parameters

            • Rest ...args: [string, ...unknown[]]

            Returns Promise<{
                error?: undefined;
                value: Readable;
            } | {
                error: Error;
                value?: undefined;
            }>

    • text: string
    \ No newline at end of file diff --git a/docs/text-to-audio-asset/variables/text_to_audio_asset_config.html b/docs/text-to-audio-asset/variables/text_to_audio_asset_config.html index dfe543c8..a9092582 100644 --- a/docs/text-to-audio-asset/variables/text_to_audio_asset_config.html +++ b/docs/text-to-audio-asset/variables/text_to_audio_asset_config.html @@ -1 +1 @@ -text_to_audio_asset_config | @jackdbd/text-to-audio-asset

    Variable text_to_audio_asset_configConst

    text_to_audio_asset_config: ZodObject<Config> = ...
    \ No newline at end of file +text_to_audio_asset_config | @jackdbd/text-to-audio-asset

    Variable text_to_audio_asset_configConst

    text_to_audio_asset_config: ZodObject<Config> = ...
    \ No newline at end of file diff --git a/fixtures/json/serve.json b/fixtures/json/serve.json new file mode 100644 index 00000000..54981b33 --- /dev/null +++ b/fixtures/json/serve.json @@ -0,0 +1,54 @@ +{ + "headers": [ + { + "source": "/service-worker.js", + "headers": [ + { + "key": "Cache-Control", + "value": "public, max-age=0, must-revalidate" + } + ] + }, + { + "source": "/index.html", + "headers": [ + { + "key": "Cache-Control", + "value": "no-store" + } + ] + }, + { + "source": "/(.*)", + "headers": [ + { + "key": "X-Content-Type-Options", + "value": "nosniff" + }, + { + "key": "X-Frame-Options", + "value": "DENY" + }, + { + "key": "X-XSS-Protection", + "value": "1; mode=block" + } + ] + }, + { + "source": "/:path*", + "has": [ + { + "type": "query", + "key": "authorized" + } + ], + "headers": [ + { + "key": "x-authorized", + "value": "true" + } + ] + } + ] +} diff --git a/package-lock.json b/package-lock.json index d167d4cd..71337483 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,7 +19,8 @@ "@google-cloud/storage": "^7.10.1", "@google-cloud/text-to-speech": "^5.2.0", "@jackdbd/checks": "^2.0.0", - "@jackdbd/zod-to-doc": "^1.0.7", + "@jackdbd/content-security-policy": "^2.1.3", + "@jackdbd/zod-to-doc": "^1.1.1", "@microsoft/api-documenter": "^7.24.2", "@microsoft/api-extractor": "^7.43.1", "@qiwi/multi-semantic-release": "^7.1.1", @@ -46,7 +47,7 @@ "rimraf": "^5.0.5", "semantic-release": "^23.0.8", "semantic-release-telegram": "^1.6.2", - "serve": "latest", + "serve": "^14.2.3", "simple-git-hooks": "^2.11.1", "specificity": "^1.0.0", "taze": "latest", @@ -2669,6 +2670,77 @@ "node": ">=16.0.0" } }, + "node_modules/@jackdbd/content-security-policy": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/@jackdbd/content-security-policy/-/content-security-policy-2.1.3.tgz", + "integrity": "sha512-N1RlDm3en7VHy7N3+Jyd8JD/JGp8PidcivjnI7kyOqWEB2EXwwDEbsYAUzdnL/VI/KHC/qpgiaImOGBTPQg+VA==", + "dev": true, + "dependencies": { + "debug": "^4.3.4", + "globby": "^14.0.0", + "himalaya": "^1.1.0", + "zod": "^3.22.4" + }, + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@jackdbd/content-security-policy/node_modules/@sindresorhus/merge-streams": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/merge-streams/-/merge-streams-2.3.0.tgz", + "integrity": "sha512-LtoMMhxAlorcGhmFYI+LhPgbPZCkgP6ra1YL604EeF6U98pLlQ3iWIGMdWSC+vWmPBWBNgmDBAhnAobLROJmwg==", + "dev": true, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@jackdbd/content-security-policy/node_modules/globby": { + "version": "14.0.1", + "resolved": "https://registry.npmjs.org/globby/-/globby-14.0.1.tgz", + "integrity": "sha512-jOMLD2Z7MAhyG8aJpNOpmziMOP4rPLcc95oQPKXBazW82z+CEgPFBQvEpRUa1KeIMUJo4Wsm+q6uzO/Q/4BksQ==", + "dev": true, + "dependencies": { + "@sindresorhus/merge-streams": "^2.1.0", + "fast-glob": "^3.3.2", + "ignore": "^5.2.4", + "path-type": "^5.0.0", + "slash": "^5.1.0", + "unicorn-magic": "^0.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@jackdbd/content-security-policy/node_modules/path-type": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-5.0.0.tgz", + "integrity": "sha512-5HviZNaZcfqP95rwpv+1HDgUamezbqdSYTyzjTvwtJSnIH+3vnbmWsItli8OFEndS984VT55M3jduxZbX351gg==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@jackdbd/content-security-policy/node_modules/slash": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-5.1.0.tgz", + "integrity": "sha512-ZA6oR3T/pEyuqwMgAKT0/hAv8oAXckzbkmR0UkUosQ+Mc4RxGoJkRmwHgHufaenlyAgE1Mxgpdcrf75y6XcnDg==", + "dev": true, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/@jackdbd/demo-site": { "resolved": "packages/demo-site", "link": true @@ -2681,10 +2753,6 @@ "resolved": "packages/eleventy-plugin-ensure-env-vars", "link": true }, - "node_modules/@jackdbd/eleventy-plugin-permissions-policy": { - "resolved": "packages/eleventy-plugin-permissions-policy", - "link": true - }, "node_modules/@jackdbd/eleventy-plugin-plausible": { "resolved": "packages/eleventy-plugin-plausible", "link": true @@ -2705,6 +2773,10 @@ "resolved": "packages/hosting-utils", "link": true }, + "node_modules/@jackdbd/permissions-policy": { + "resolved": "packages/permissions-policy", + "link": true + }, "node_modules/@jackdbd/plausible-client": { "version": "1.0.2", "license": "MIT", @@ -2739,15 +2811,15 @@ "link": true }, "node_modules/@jackdbd/zod-to-doc": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/@jackdbd/zod-to-doc/-/zod-to-doc-1.0.7.tgz", - "integrity": "sha512-zcp9VJJ+3i1fi65j+kor/NpjFQv55KHE7hqLbnIGBTLL8JyXI8HPjhj3PEB39XKW1ev2ZGPhUT4bmYECw3uuLw==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@jackdbd/zod-to-doc/-/zod-to-doc-1.1.1.tgz", + "integrity": "sha512-RkDUketyX8NMnqWbKwbfrUOpDQ6rUDXs5Jo+HB+bzC9havha4tK6qJurFBbVQI5obkmwsxQnqisJ8YBfGOqmTg==", "dev": true, "dependencies": { "ansi-colors": "^4.1.3", "debug": "^4.3.4", "yargs": "^17.7.2", - "zod": "^3.22.4" + "zod": "^3.23.4" }, "bin": { "ztd": "dist/cli.js" @@ -9911,9 +9983,9 @@ } }, "node_modules/@zeit/schemas": { - "version": "2.29.0", - "resolved": "https://registry.npmjs.org/@zeit/schemas/-/schemas-2.29.0.tgz", - "integrity": "sha512-g5QiLIfbg3pLuYUJPlisNKY+epQJTcMDsOnVNkscrDP1oi7vmJnzOANYJI/1pZcVJ6umUkBv3aFtlg1UvUHGzA==", + "version": "2.36.0", + "resolved": "https://registry.npmjs.org/@zeit/schemas/-/schemas-2.36.0.tgz", + "integrity": "sha512-7kjMwcChYEzMKjeex9ZFXkt1AyNov9R5HZtjBKVsmVpw7pa7ZtlCGvCBC2vnnXctaYN+aRI61HjIqeetZW5ROg==", "dev": true }, "node_modules/a-sync-waterfall": { @@ -21774,12 +21846,12 @@ } }, "node_modules/serve": { - "version": "14.2.2", - "resolved": "https://registry.npmjs.org/serve/-/serve-14.2.2.tgz", - "integrity": "sha512-MktTGv3ooijGxd67iQVocNdiHaOdNnEApGj7At4qHUN44XDaLFfrqbEtj5mXf+QNqyig/VdHYMRTXWRQj6TEbw==", + "version": "14.2.3", + "resolved": "https://registry.npmjs.org/serve/-/serve-14.2.3.tgz", + "integrity": "sha512-VqUFMC7K3LDGeGnJM9h56D3XGKb6KGgOw0cVNtA26yYXHCcpxf3xwCTUaQoWlVS7i8Jdh3GjQkOB23qsXyjoyQ==", "dev": true, "dependencies": { - "@zeit/schemas": "2.29.0", + "@zeit/schemas": "2.36.0", "ajv": "8.12.0", "arg": "5.0.2", "boxen": "7.0.0", @@ -24250,13 +24322,24 @@ } }, "node_modules/zod": { - "version": "3.22.4", - "dev": true, - "license": "MIT", + "version": "3.23.4", + "resolved": "https://registry.npmjs.org/zod/-/zod-3.23.4.tgz", + "integrity": "sha512-/AtWOKbBgjzEYYQRNfoGKHObgfAZag6qUJX1VbHo2PRBgS+wfWagEY2mizjfyAPcGesrJOcx/wcl0L9WnVrHFw==", "funding": { "url": "https://github.com/sponsors/colinhacks" } }, + "node_modules/zod-validation-error": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/zod-validation-error/-/zod-validation-error-3.2.0.tgz", + "integrity": "sha512-cYlPR6zuyrgmu2wRTdumEAJGuwI7eHVHGT+VyneAQxmRAKtGRL1/7pjz4wfLhz4J05f5qoSZc3rGacswgyTjjw==", + "engines": { + "node": ">=18.0.0" + }, + "peerDependencies": { + "zod": "^3.18.0" + } + }, "node_modules/zx": { "version": "8.0.2", "resolved": "https://registry.npmjs.org/zx/-/zx-8.0.2.tgz", @@ -24291,11 +24374,11 @@ }, "packages/eleventy-plugin-content-security-policy": { "name": "@jackdbd/eleventy-plugin-content-security-policy", - "version": "2.1.2", + "version": "2.2.0-canary.1", "license": "MIT", "dependencies": { "@jackdbd/content-security-policy": "3.0.0-canary.1", - "@jackdbd/hosting-utils": "*", + "@jackdbd/hosting-utils": "1.0.0-canary.1", "zod": "^3.23.0", "zod-validation-error": "^3.1.0" }, @@ -24397,7 +24480,7 @@ }, "packages/eleventy-plugin-ensure-env-vars": { "name": "@jackdbd/eleventy-plugin-ensure-env-vars", - "version": "1.1.1", + "version": "1.2.0-canary.1", "license": "MIT", "dependencies": { "zod": "^3.23.0", @@ -24435,10 +24518,12 @@ }, "packages/eleventy-plugin-permissions-policy": { "name": "@jackdbd/eleventy-plugin-permissions-policy", - "version": "1.1.1", + "version": "1.2.0-canary.1", + "extraneous": true, "license": "MIT", "dependencies": { - "@jackdbd/hosting-utils": "*", + "@jackdbd/hosting-utils": "1.0.0-canary.1", + "@jackdbd/permissions-policy": "*", "zod": "^3.23.0", "zod-validation-error": "^3.1.0" }, @@ -24453,28 +24538,9 @@ "debug": ">=4.0.0" } }, - "packages/eleventy-plugin-permissions-policy/node_modules/zod": { - "version": "3.23.0", - "resolved": "https://registry.npmjs.org/zod/-/zod-3.23.0.tgz", - "integrity": "sha512-OFLT+LTocvabn6q76BTwVB0hExEBS0IduTr3cqZyMqEDbOnYmcU+y0tUAYbND4uwclpBGi4I4UUBGzylWpjLGA==", - "funding": { - "url": "https://github.com/sponsors/colinhacks" - } - }, - "packages/eleventy-plugin-permissions-policy/node_modules/zod-validation-error": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/zod-validation-error/-/zod-validation-error-3.1.0.tgz", - "integrity": "sha512-zujS6HqJjMZCsvjfbnRs7WI3PXN39ovTcY1n8a+KTm4kOH0ZXYsNiJkH1odZf4xZKMkBDL7M2rmQ913FCS1p9w==", - "engines": { - "node": ">=18.0.0" - }, - "peerDependencies": { - "zod": "^3.18.0" - } - }, "packages/eleventy-plugin-plausible": { "name": "@jackdbd/eleventy-plugin-plausible", - "version": "1.1.0", + "version": "1.2.0-canary.1", "license": "MIT", "dependencies": { "@jackdbd/plausible-client": "^1.0.2", @@ -24513,7 +24579,7 @@ }, "packages/eleventy-plugin-telegram": { "name": "@jackdbd/eleventy-plugin-telegram", - "version": "2.1.0", + "version": "2.2.0-canary.1", "license": "MIT", "dependencies": { "zod": "^3.23.0", @@ -24551,7 +24617,7 @@ }, "packages/eleventy-plugin-text-to-speech": { "name": "@jackdbd/eleventy-plugin-text-to-speech", - "version": "3.1.0", + "version": "3.2.0-canary.1", "license": "MIT", "dependencies": { "@jackdbd/zod-schemas": "^2.2.0", @@ -24635,7 +24701,7 @@ }, "packages/hosting-utils": { "name": "@jackdbd/hosting-utils", - "version": "0.1.0", + "version": "1.0.0-canary.1", "license": "MIT", "dependencies": { "netlify-headers-parser": "^7.1.4", @@ -24651,9 +24717,27 @@ "debug": ">=4.0.0" } }, + "packages/permissions-policy": { + "name": "@jackdbd/permissions-policy", + "version": "0.1.0", + "license": "MIT", + "dependencies": { + "zod": "^3.23.4", + "zod-validation-error": "^3.2.0" + }, + "devDependencies": { + "@jackdbd/eleventy-test-utils": "*" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "debug": ">=4.0.0" + } + }, "packages/text-to-audio-asset": { "name": "@jackdbd/text-to-audio-asset", - "version": "1.1.0", + "version": "1.2.0-canary.1", "license": "MIT", "dependencies": { "zod": "^3.23.0", diff --git a/package.json b/package.json index 4b52eb89..742dd68d 100644 --- a/package.json +++ b/package.json @@ -46,6 +46,7 @@ "docs:root": "./scripts/docs-root.mjs", "lint": "npm run lint --workspaces --if-present", "nuke": "npm run clean && rm -rf node_modules package-lock.json", + "permissions-policy": "DEBUG='script:*,hosting-utils*' tsm ./scripts/permissions-policy.ts", "publint": "npm run publint --workspaces --if-present", "readme": "run-s 'readme:libs' 'readme:root' --print-label", "readme:libs": "npm run readme --workspaces --if-present", @@ -53,7 +54,7 @@ "release:dry": "multi-semantic-release --no-ci --dry-run --debug --ignore-private --ignore-packages=packages/demo-site", "serve:fixtures": "serve ./fixtures/html --port 8095", "serve:docs": "serve ./docs/ -p 8090", - "serve:site": "serve ./packages/demo-site/_site/ -p 8080", + "serve:site": "npm run serve -w packages/demo-site", "size": "npm run size --workspaces --if-present", "test": "npm run test --workspaces --if-present", "test:ci": "npm run test:ci --workspaces --if-present", @@ -69,7 +70,8 @@ "@google-cloud/storage": "^7.10.1", "@google-cloud/text-to-speech": "^5.2.0", "@jackdbd/checks": "^2.0.0", - "@jackdbd/zod-to-doc": "^1.0.7", + "@jackdbd/content-security-policy": "^2.1.3", + "@jackdbd/zod-to-doc": "^1.1.1", "@microsoft/api-documenter": "^7.24.2", "@microsoft/api-extractor": "^7.43.1", "@qiwi/multi-semantic-release": "^7.1.1", @@ -96,7 +98,7 @@ "rimraf": "^5.0.5", "semantic-release": "^23.0.8", "semantic-release-telegram": "^1.6.2", - "serve": "latest", + "serve": "^14.2.3", "simple-git-hooks": "^2.11.1", "specificity": "^1.0.0", "taze": "latest", diff --git a/packages/demo-site/eleventy.mjs b/packages/demo-site/eleventy.mjs index aafcd2ea..0a6de7a7 100644 --- a/packages/demo-site/eleventy.mjs +++ b/packages/demo-site/eleventy.mjs @@ -4,8 +4,6 @@ import slugify from 'slugify' import helmet from 'eleventy-plugin-helmet' import navigation from '@11ty/eleventy-navigation' import { ensureEnvVarsPlugin } from '@jackdbd/eleventy-plugin-ensure-env-vars' -import { permissionsPolicyPlugin } from '@jackdbd/eleventy-plugin-permissions-policy' -import { contentSecurityPolicyPlugin } from '@jackdbd/eleventy-plugin-content-security-policy' import { telegramPlugin } from '@jackdbd/eleventy-plugin-telegram' import { textToSpeechPlugin } from '@jackdbd/eleventy-plugin-text-to-speech' import { defClient as defCloudflareR2Client } from '@jackdbd/eleventy-plugin-text-to-speech/hosting/cloudflare-r2' @@ -26,9 +24,6 @@ import { copyright } from './src/shortcodes/index.js' const __filename = fileURLToPath(import.meta.url) const FILE_NAME = path.basename(__filename) -const hosting = 'cloudflare-pages' -// const hosting = 'vercel' - export default async function (eleventyConfig) { // 11ty shortcodes // https://www.11ty.dev/docs/shortcodes/ @@ -52,45 +47,6 @@ export default async function (eleventyConfig) { eleventyConfig.addPlugin(ensureEnvVarsPlugin) - // Here I register contentSecurityPolicyPlugin twice to show that it generates - // different Content-Security-Policy headers for different URL patterns. - - eleventyConfig.addPlugin(contentSecurityPolicyPlugin, { - directives: { - 'base-uri': ['self'], - 'default-src': ['none'], - 'img-src': ['self'], - 'script-src': ['self'], - 'style-src': ['self'] - }, - globPatterns: ['/*'], - globPatternsDetach: ['/*.png'], - hosting - }) - - eleventyConfig.addPlugin(contentSecurityPolicyPlugin, { - directives: { - 'default-src': ['self'] - }, - globPatterns: ['/nested/*'], - hosting - }) - - eleventyConfig.addPlugin(permissionsPolicyPlugin, { - directives: [ - { feature: 'autoplay', allowlist: ['*'] }, - { feature: 'geolocation', allowlist: ['self'] }, - { - feature: 'camera', - allowlist: ['self', 'https://trusted-site.example'] - }, - { feature: 'fullscreen', allowlist: [] } - ], - hosting, - includeFeaturePolicy: true, - jsonRecap: true - }) - const { chat_id: chatId, token } = JSON.parse(process.env.TELEGRAM) eleventyConfig.addPlugin(telegramPlugin, { chatId, diff --git a/packages/demo-site/package.json b/packages/demo-site/package.json index 7d811aec..61a6e1c5 100644 --- a/packages/demo-site/package.json +++ b/packages/demo-site/package.json @@ -20,7 +20,10 @@ }, "type": "module", "scripts": { - "build": "DEBUG='hosting-utils:*,11ty-plugin:csp:*,11ty-plugin:permissions-policy:*' eleventy --config eleventy.mjs", + "build": "run-s build:eleventy build:csp build:pp", + "build:eleventy": "eleventy --config eleventy.mjs", + "build:csp": "DEBUG='hosting-utils:*,csp:*,script:*' tsm ./scripts/content-security-policy.ts", + "build:pp": "DEBUG='hosting-utils:*,permissions-policy,script:*' tsm ./scripts/permissions-policy.ts", "clean": "rimraf _site/ .cache/", "dev": "eleventy --config eleventy.mjs --serve --port 8090", "deploy": "npx wrangler pages deploy _site --project-name undici", @@ -28,6 +31,7 @@ "lint": "eslint --config ../../config/eslint.cjs", "nuke": "npm run clean && rimraf node_modules 'package-lock.json'", "precommit": "lint-staged --config ../../config/lint-staged.cjs", + "serve": "serve _site/ -p 8090", "size": "pkg-size ./_site --sort-by=brotli --ignore-files {*.d.ts,*.map}" }, "dependencies": { diff --git a/packages/demo-site/scripts/content-security-policy.ts b/packages/demo-site/scripts/content-security-policy.ts new file mode 100644 index 00000000..0a64067d --- /dev/null +++ b/packages/demo-site/scripts/content-security-policy.ts @@ -0,0 +1,97 @@ +import fs from 'node:fs' +import path from 'node:path' +import { fileURLToPath } from 'node:url' +import defDebug from 'debug' +import { DEMO_SITE_ROOT } from '@jackdbd/eleventy-test-utils' +import { updateServeJSON } from '@jackdbd/hosting-utils' +import { cspHeader } from '@jackdbd/content-security-policy' + +export const __filename = fileURLToPath(import.meta.url) +const SCRIPT_NAME = path.basename(__filename, '.ts') +const debug = defDebug(`script:${SCRIPT_NAME}`) + +interface Config { + directives: any + filepath: string + reportOnly?: boolean + sources: string[] +} + +const main = async (config: Config) => { + debug(`update ${config.filepath} %O`, config) + const { directives, filepath, reportOnly, sources } = config + + if (sources.length == 0) { + debug(`no sources specified. Early return`) + return + } + + const cfg = path.basename(filepath) + const ext = path.extname(filepath) + + if (cfg !== 'serve.json') { + throw new Error(`${cfg} is not a supported configuration file.`) + } + + const headerKey = reportOnly + ? 'Content-Security-Policy-Report-Only' + : 'Content-Security-Policy' + + const headerValue = await cspHeader({ directives, patterns: sources }) + + const { error, value: message } = await updateServeJSON({ + filepath, + headerKey, + headerValue, + sources + }) + if (error) { + throw error + } + if (message) { + debug(message) + } + + const str = fs.readFileSync(filepath, { encoding: 'utf8' }) + console.log(`updated ${filepath}`) + console.log(str) +} + +// use this script to update Content-Security-Policy for the demo site +await main({ + directives: { + 'base-uri': ['self'], + 'default-src': ['none'], + // 'font-src': ['self'], + 'img-src': ['self'], + // allow