diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2023-10-14 15:05:55 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2023-10-14 15:05:55 +0800 |
| commit | c06f7ee0a40255214c477e13d9b956a7e07c2900 (patch) | |
| tree | f5982a568ef8fab865d0142e71c7494fea3e4c1b /node_modules/@csstools/postcss-font-format-keywords | |
| parent | 3fd9400d4dccc25aa29b5702216732e0b7542073 (diff) | |
postcss,(plugins): nanocss, postcss-preset-env
Diffstat (limited to 'node_modules/@csstools/postcss-font-format-keywords')
8 files changed, 232 insertions, 0 deletions
diff --git a/node_modules/@csstools/postcss-font-format-keywords/CHANGELOG.md b/node_modules/@csstools/postcss-font-format-keywords/CHANGELOG.md new file mode 100644 index 00000000..78f76768 --- /dev/null +++ b/node_modules/@csstools/postcss-font-format-keywords/CHANGELOG.md @@ -0,0 +1,37 @@ +# Changes to PostCSS Font Format + +### 3.0.0 + +_July 3, 2023_ + +- Change license to `MIT-0` ([read more about this change in the blog post](https://preset-env.cssdb.org/blog/license-change/)) + +### 2.0.2 + +_February 8, 2023_ + +- Reduce the amount of duplicate fallback CSS. + +### 2.0.1 + +_January 28, 2023_ + +- Improve `types` declaration in `package.json` + +### 2.0.0 + +_January 24, 2023_ + +- Updated: Support for Node v14+ (major). + +### 1.0.1 + +_July 8, 2022_ + +- Fix case insensitive matching. + +### 1.0.0 + +_January 25, 2022_ + +- Initial version diff --git a/node_modules/@csstools/postcss-font-format-keywords/LICENSE.md b/node_modules/@csstools/postcss-font-format-keywords/LICENSE.md new file mode 100644 index 00000000..e8ae93b9 --- /dev/null +++ b/node_modules/@csstools/postcss-font-format-keywords/LICENSE.md @@ -0,0 +1,18 @@ +MIT No Attribution (MIT-0) + +Copyright © CSSTools Contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the “Software”), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/@csstools/postcss-font-format-keywords/README.md b/node_modules/@csstools/postcss-font-format-keywords/README.md new file mode 100644 index 00000000..bf4927ee --- /dev/null +++ b/node_modules/@csstools/postcss-font-format-keywords/README.md @@ -0,0 +1,86 @@ +# PostCSS Font Format [<img src="https://postcss.github.io/postcss/logo.svg" alt="PostCSS Logo" width="90" height="90" align="right">][postcss] + +[<img alt="npm version" src="https://img.shields.io/npm/v/@csstools/postcss-font-format-keywords.svg" height="20">][npm-url] +[<img alt="CSS Standard Status" src="https://cssdb.org/images/badges/font-format-keywords.svg" height="20">][css-url] +[<img alt="Build Status" src="https://github.com/csstools/postcss-plugins/workflows/test/badge.svg" height="20">][cli-url] +[<img alt="Discord" src="https://shields.io/badge/Discord-5865F2?logo=discord&logoColor=white">][discord] + +[PostCSS Font Format Keywords] lets you specify font formats as keywords, following the [CSS Fonts] specification. + +```pcss +@font-face { + src: url(file.woff2) format(woff2); +} + +/* becomes */ + +@font-face { + src: url(file.woff2) format("woff2"); +} +``` + +_See prior work by [valtlai](https://github.com/valtlai) here [postcss-font-format-keywords](https://github.com/valtlai/postcss-font-format-keywords) +To ensure long term maintenance and to provide the needed features this plugin was recreated based on valtlai's work._ + +## Usage + +Add [PostCSS Font Format Keywords] to your project: + +```bash +npm install postcss @csstools/postcss-font-format-keywords --save-dev +``` + +Use it as a [PostCSS] plugin: + +```js +const postcss = require('postcss'); +const postcssFontFormatKeywords = require('@csstools/postcss-font-format-keywords'); + +postcss([ + postcssFontFormatKeywords(/* pluginOptions */) +]).process(YOUR_CSS /*, processOptions */); +``` + +[PostCSS Font Format Keywords] runs in all Node environments, with special +instructions for: + +| [Node](INSTALL.md#node) | [PostCSS CLI](INSTALL.md#postcss-cli) | [Webpack](INSTALL.md#webpack) | [Gulp](INSTALL.md#gulp) | [Grunt](INSTALL.md#grunt) | +| --- | --- | --- | --- | --- | + +## Options + +### preserve + +The `preserve` option determines whether the original source +is preserved. By default, it is not preserved. + +```js +postcssFontFormatKeywords({ preserve: true }) +``` + +```pcss +@font-face { + src: url(file.woff2) format(woff2); +} + +/* becomes */ + +@font-face { + src: url(file.woff2) format("woff2"); + src: url(file.woff2) format(woff2); +} +``` + +[postcss]: https://github.com/postcss/postcss + +[cli-url]: https://github.com/csstools/postcss-plugins/actions/workflows/test.yml?query=workflow/test +[css-url]: https://cssdb.org/#font-format-keywords +[discord]: https://discord.gg/bUadyRwkJS +[npm-url]: https://www.npmjs.com/package/@csstools/postcss-font-format-keywords + +[CSS Fonts]: https://www.w3.org/TR/css-fonts-4/#font-format-values +[Gulp PostCSS]: https://github.com/postcss/gulp-postcss +[Grunt PostCSS]: https://github.com/nDmitry/grunt-postcss +[PostCSS]: https://github.com/postcss/postcss +[PostCSS Loader]: https://github.com/postcss/postcss-loader +[PostCSS Font Format Keywords]: https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-font-format-keywords diff --git a/node_modules/@csstools/postcss-font-format-keywords/dist/has-fallback-decl.d.ts b/node_modules/@csstools/postcss-font-format-keywords/dist/has-fallback-decl.d.ts new file mode 100644 index 00000000..d7ae8d89 --- /dev/null +++ b/node_modules/@csstools/postcss-font-format-keywords/dist/has-fallback-decl.d.ts @@ -0,0 +1,2 @@ +import type { Declaration } from 'postcss'; +export declare function hasFallback(node: Declaration): boolean; diff --git a/node_modules/@csstools/postcss-font-format-keywords/dist/index.cjs b/node_modules/@csstools/postcss-font-format-keywords/dist/index.cjs new file mode 100644 index 00000000..7ffbcdcb --- /dev/null +++ b/node_modules/@csstools/postcss-font-format-keywords/dist/index.cjs @@ -0,0 +1 @@ +"use strict";var e=require("postcss-value-parser");function hasFallback(e){const t=e.parent;if(!t)return!1;const o=e.prop.toLowerCase(),r=t.index(e);for(let e=0;e<r;e++){const r=t.nodes[e];if("decl"===r.type&&r.prop.toLowerCase()===o)return!0}return!1}const t=["woff","truetype","opentype","woff2","embedded-opentype","collection","svg"],creator=o=>{const r="preserve"in Object(o)&&Boolean(null==o?void 0:o.preserve);return{postcssPlugin:"postcss-font-format-keywords",Declaration(o){if("src"!==o.prop.toLowerCase())return;if(!o.value.toLowerCase().includes("format("))return;if(hasFallback(o))return;const n=o.parent;if(!n||"atrule"!==n.type)return;if("font-face"!==n.name.toLowerCase())return;const s=e(o.value);s.walk((o=>{"function"===o.type&&"format"===o.value.toLowerCase()&&o.nodes.forEach((o=>{"word"===o.type&&t.includes(o.value.toLowerCase())&&(o.value=e.stringify({type:"string",value:o.value,quote:'"'}))}))})),s.toString()!==o.value&&(o.cloneBefore({value:s.toString()}),r||o.remove())}}};creator.postcss=!0,module.exports=creator; diff --git a/node_modules/@csstools/postcss-font-format-keywords/dist/index.d.ts b/node_modules/@csstools/postcss-font-format-keywords/dist/index.d.ts new file mode 100644 index 00000000..08f71203 --- /dev/null +++ b/node_modules/@csstools/postcss-font-format-keywords/dist/index.d.ts @@ -0,0 +1,8 @@ +import type { PluginCreator } from 'postcss'; +/** postcss-font-format-keywords plugin options */ +export type pluginOptions = { + /** Preserve the original notation. default: false */ + preserve?: boolean; +}; +declare const creator: PluginCreator<pluginOptions>; +export default creator; diff --git a/node_modules/@csstools/postcss-font-format-keywords/dist/index.mjs b/node_modules/@csstools/postcss-font-format-keywords/dist/index.mjs new file mode 100644 index 00000000..896d2b41 --- /dev/null +++ b/node_modules/@csstools/postcss-font-format-keywords/dist/index.mjs @@ -0,0 +1 @@ +import e from"postcss-value-parser";function hasFallback(e){const o=e.parent;if(!o)return!1;const t=e.prop.toLowerCase(),r=o.index(e);for(let e=0;e<r;e++){const r=o.nodes[e];if("decl"===r.type&&r.prop.toLowerCase()===t)return!0}return!1}const o=["woff","truetype","opentype","woff2","embedded-opentype","collection","svg"],creator=t=>{const r="preserve"in Object(t)&&Boolean(null==t?void 0:t.preserve);return{postcssPlugin:"postcss-font-format-keywords",Declaration(t){if("src"!==t.prop.toLowerCase())return;if(!t.value.toLowerCase().includes("format("))return;if(hasFallback(t))return;const n=t.parent;if(!n||"atrule"!==n.type)return;if("font-face"!==n.name.toLowerCase())return;const s=e(t.value);s.walk((t=>{"function"===t.type&&"format"===t.value.toLowerCase()&&t.nodes.forEach((t=>{"word"===t.type&&o.includes(t.value.toLowerCase())&&(t.value=e.stringify({type:"string",value:t.value,quote:'"'}))}))})),s.toString()!==t.value&&(t.cloneBefore({value:s.toString()}),r||t.remove())}}};creator.postcss=!0;export{creator as default}; diff --git a/node_modules/@csstools/postcss-font-format-keywords/package.json b/node_modules/@csstools/postcss-font-format-keywords/package.json new file mode 100644 index 00000000..2f41adca --- /dev/null +++ b/node_modules/@csstools/postcss-font-format-keywords/package.json @@ -0,0 +1,79 @@ +{ + "name": "@csstools/postcss-font-format-keywords", + "description": "Use unquoted format on @font-face CSS definitions.", + "version": "3.0.0", + "author": "Jonathan Neal <jonathantneal@hotmail.com>", + "license": "MIT-0", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "engines": { + "node": "^14 || ^16 || >=18" + }, + "main": "dist/index.cjs", + "module": "dist/index.mjs", + "types": "dist/index.d.ts", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "import": "./dist/index.mjs", + "require": "./dist/index.cjs", + "default": "./dist/index.mjs" + } + }, + "files": [ + "CHANGELOG.md", + "LICENSE.md", + "README.md", + "dist" + ], + "dependencies": { + "postcss-value-parser": "^4.2.0" + }, + "peerDependencies": { + "postcss": "^8.4" + }, + "devDependencies": { + "@csstools/postcss-tape": "*" + }, + "scripts": { + "build": "rollup -c ../../rollup/default.mjs", + "docs": "node ../../.github/bin/generate-docs/install.mjs", + "lint": "node ../../.github/bin/format-package-json.mjs", + "prepublishOnly": "npm run build && npm run test", + "test": "node .tape.mjs && node ./test/_import.mjs && node ./test/_require.cjs", + "test:rewrite-expects": "REWRITE_EXPECTS=true node .tape.mjs" + }, + "homepage": "https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-font-format-keywords#readme", + "repository": { + "type": "git", + "url": "https://github.com/csstools/postcss-plugins.git", + "directory": "plugins/postcss-font-format-keywords" + }, + "keywords": [ + "css", + "embedded-opentype", + "font", + "font-format-keywords", + "format", + "opentype", + "postcss-plugin", + "truetype", + "woff", + "woff2" + ], + "csstools": { + "exportName": "postcssFontFormatKeywords", + "humanReadableName": "PostCSS Font Format Keywords" + }, + "volta": { + "extends": "../../package.json" + } +} |
