postcss-normalize-charset 5.0.3 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "postcss-normalize-charset",
3
- "version": "5.0.3",
3
+ "version": "6.0.0",
4
4
  "description": "Add necessary or remove extra charset with PostCSS",
5
5
  "keywords": [
6
6
  "postcss",
@@ -11,7 +11,8 @@
11
11
  "author": "Bogdan Chadkin <trysound@yandex.ru>",
12
12
  "files": [
13
13
  "src",
14
- "LICENSE"
14
+ "LICENSE",
15
+ "types"
15
16
  ],
16
17
  "license": "MIT",
17
18
  "repository": "cssnano/cssnano",
@@ -20,14 +21,14 @@
20
21
  },
21
22
  "homepage": "https://github.com/cssnano/cssnano",
22
23
  "main": "src/index.js",
24
+ "types": "types/index.d.ts",
23
25
  "engines": {
24
- "node": "^10 || ^12 || >=14.0"
26
+ "node": "^14 || ^16 || >=18.0"
25
27
  },
26
28
  "devDependencies": {
27
29
  "postcss": "^8.2.15"
28
30
  },
29
31
  "peerDependencies": {
30
32
  "postcss": "^8.2.15"
31
- },
32
- "readme": "# postcss-normalize-charset\n\nAdd necessary or remove extra charset with PostCSS\n\n```css\na{\n content: \"©\";\n}\n```\n\n```css\n@charset \"utf-8\";\na{\n content: \"©\";\n}\n```\n\n## API\n\n### normalizeCharset([options])\n\n#### options\n\n##### add\n\nType: `boolean` \nDefault: `true`\n\nPass `false` to stop the module from adding a `@charset` declaration if it was\nmissing from the file (and the file contained non-ascii characters).\n\n## Usage\n\nSee the [PostCSS documentation](https://github.com/postcss/postcss#usage) for\nexamples for your environment.\n\n## Contributors\n\nSee [CONTRIBUTORS.md](https://github.com/cssnano/cssnano/blob/master/CONTRIBUTORS.md).\n\n## License\n\nMIT © [Bogdan Chadkin](mailto:trysound@yandex.ru)\n"
33
+ }
33
34
  }
package/src/index.js CHANGED
@@ -3,12 +3,22 @@ const charset = 'charset';
3
3
  // eslint-disable-next-line no-control-regex
4
4
  const nonAscii = /[^\x00-\x7F]/;
5
5
 
6
+ /**
7
+ * @typedef {{add?: boolean}} Options
8
+ */
9
+ /**
10
+ * @type {import('postcss').PluginCreator<Options>}
11
+ * @param {Options} opts
12
+ * @return {import('postcss').Plugin}
13
+ */
6
14
  function pluginCreator(opts = {}) {
7
15
  return {
8
16
  postcssPlugin: 'postcss-normalize-' + charset,
9
17
 
10
18
  OnceExit(css, { AtRule }) {
19
+ /** @type {import('postcss').AtRule | undefined} */
11
20
  let charsetRule;
21
+ /** @type {import('postcss').Node | undefined} */
12
22
  let nonAsciiNode;
13
23
 
14
24
  css.walk((node) => {
@@ -0,0 +1,17 @@
1
+ export = pluginCreator;
2
+ /**
3
+ * @typedef {{add?: boolean}} Options
4
+ */
5
+ /**
6
+ * @type {import('postcss').PluginCreator<Options>}
7
+ * @param {Options} opts
8
+ * @return {import('postcss').Plugin}
9
+ */
10
+ declare function pluginCreator(opts?: Options): import('postcss').Plugin;
11
+ declare namespace pluginCreator {
12
+ export { postcss, Options };
13
+ }
14
+ type Options = {
15
+ add?: boolean;
16
+ };
17
+ declare var postcss: true;