Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add link and description for options #786

Merged
merged 2 commits into from
Jul 12, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
refactor: update schema
  • Loading branch information
snitin315 committed Jul 12, 2021
commit 62a9288ea4a394517d8f4895f9f0a4759ac450d3
6 changes: 3 additions & 3 deletions src/loader-options.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@
}
],
"description": "Specifies a custom public path for the external resources like images, files, etc inside CSS.",
"link": "https://webpack.js.org/plugins/mini-css-extract-plugin/#publicpath"
"link": "https://github.com/webpack-contrib/mini-css-extract-plugin#publicpath"
},
"emit": {
"type": "boolean",
"description": "If true, emits a file (writes a file to the filesystem). If false, the plugin will extract the CSS but will not emit the file",
"link": "https://webpack.js.org/plugins/mini-css-extract-plugin/#emit"
"link": "https://github.com/webpack-contrib/mini-css-extract-plugin#emit"
},
"esModule": {
"type": "boolean",
"description": "Generates JS modules that use the ES modules syntax.",
"link": "https://webpack.js.org/plugins/mini-css-extract-plugin/#esmodule"
"link": "https://github.com/webpack-contrib/mini-css-extract-plugin#esmodule"
},
"layer": {
"type": "string"
Expand Down
14 changes: 7 additions & 7 deletions src/plugin-options.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
}
],
"description": "This option determines the name of each output CSS file.",
"link": "https://webpack.js.org/plugins/mini-css-extract-plugin/#filename"
"link": "https://github.com/webpack-contrib/mini-css-extract-plugin#filename"
},
"chunkFilename": {
"anyOf": [
Expand All @@ -25,21 +25,21 @@
}
],
"description": "This option determines the name of non-entry chunk files.",
"link": "https://webpack.js.org/plugins/mini-css-extract-plugin/#chunkfilename"
"link": "https://github.com/webpack-contrib/mini-css-extract-plugin#chunkfilename"
},
"experimentalUseImportModule": {
"type": "boolean",
"description": "Enable the experimental importModule approach instead of using child compilers. This uses less memory and is faster.",
"link": "https://webpack.js.org/plugins/mini-css-extract-plugin/#experimentaluseimportmodule"
"link": "https://github.com/webpack-contrib/mini-css-extract-plugin#experimentaluseimportmodule"
},
"ignoreOrder": {
"type": "boolean",
"description": "Remove Order Warnings.",
"link": "https://webpack.js.org/plugins/mini-css-extract-plugin/#ignoreorder"
"link": "https://github.com/webpack-contrib/mini-css-extract-plugin#ignoreorder"
},
"insert": {
"description": "Inserts `<link>` at the given position.",
"link": "https://webpack.js.org/plugins/mini-css-extract-plugin/#insert",
"link": "https://github.com/webpack-contrib/mini-css-extract-plugin#insert",
"anyOf": [
{
"type": "string"
Expand All @@ -51,7 +51,7 @@
},
"attributes": {
"description": "Adds custom attributes to tag.",
"link": "https://webpack.js.org/plugins/mini-css-extract-plugin/#attributes",
"link": "https://github.com/webpack-contrib/mini-css-extract-plugin#attributes",
"type": "object"
},
"linkType": {
Expand All @@ -64,7 +64,7 @@
}
],
"description": "This option allows loading asynchronous chunks with a custom link type",
"link": "https://webpack.js.org/plugins/mini-css-extract-plugin/#linktype"
"link": "https://github.com/webpack-contrib/mini-css-extract-plugin#linktype"
}
}
}
4 changes: 2 additions & 2 deletions test/__snapshots__/validate-loader-options.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ exports[`validate options should throw an error on the "esModule" option with "1
"Invalid options object. Mini CSS Extract Plugin Loader has been initialized using an options object that does not match the API schema.
- options.esModule should be a boolean.
-> Generates JS modules that use the ES modules syntax.
-> Read more at https://webpack.js.org/plugins/mini-css-extract-plugin/#esmodule"
-> Read more at https://github.com/webpack-contrib/mini-css-extract-plugin#esmodule"
`;

exports[`validate options should throw an error on the "publicPath" option with "true" value 1`] = `
"Invalid options object. Mini CSS Extract Plugin Loader has been initialized using an options object that does not match the API schema.
- options.publicPath should be one of these:
string | function
-> Specifies a custom public path for the external resources like images, files, etc inside CSS.
-> Read more at https://webpack.js.org/plugins/mini-css-extract-plugin/#publicpath
-> Read more at https://github.com/webpack-contrib/mini-css-extract-plugin#publicpath
Details:
* options.publicPath should be a string.
* options.publicPath should be an instance of function."
Expand Down
22 changes: 11 additions & 11 deletions test/__snapshots__/validate-plugin-options.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ exports[`validate options should throw an error on the "attributes" option with
- options.attributes should be an object:
object { … }
-> Adds custom attributes to tag.
-> Read more at https://webpack.js.org/plugins/mini-css-extract-plugin/#attributes"
-> Read more at https://github.com/webpack-contrib/mini-css-extract-plugin#attributes"
`;

exports[`validate options should throw an error on the "chunkFilename" option with "true" value 1`] = `
"Invalid options object. Mini CSS Extract Plugin has been initialized using an options object that does not match the API schema.
- options.chunkFilename should be one of these:
string | function
-> This option determines the name of non-entry chunk files.
-> Read more at https://webpack.js.org/plugins/mini-css-extract-plugin/#chunkfilename
-> Read more at https://github.com/webpack-contrib/mini-css-extract-plugin#chunkfilename
Details:
* options.chunkFilename should be a string.
* options.chunkFilename should be an instance of function."
Expand All @@ -24,7 +24,7 @@ exports[`validate options should throw an error on the "filename" option with "t
- options.filename should be one of these:
string | function
-> This option determines the name of each output CSS file.
-> Read more at https://webpack.js.org/plugins/mini-css-extract-plugin/#filename
-> Read more at https://github.com/webpack-contrib/mini-css-extract-plugin#filename
Details:
* options.filename should be a string.
* options.filename should be an instance of function."
Expand All @@ -34,15 +34,15 @@ exports[`validate options should throw an error on the "ignoreOrder" option with
"Invalid options object. Mini CSS Extract Plugin has been initialized using an options object that does not match the API schema.
- options.ignoreOrder should be a boolean.
-> Remove Order Warnings.
-> Read more at https://webpack.js.org/plugins/mini-css-extract-plugin/#ignoreorder"
-> Read more at https://github.com/webpack-contrib/mini-css-extract-plugin#ignoreorder"
`;

exports[`validate options should throw an error on the "insert" option with "{}" value 1`] = `
"Invalid options object. Mini CSS Extract Plugin has been initialized using an options object that does not match the API schema.
- options.insert should be one of these:
string | function
-> Inserts \`<link>\` at the given position.
-> Read more at https://webpack.js.org/plugins/mini-css-extract-plugin/#insert
-> Read more at https://github.com/webpack-contrib/mini-css-extract-plugin#insert
Details:
* options.insert should be a string.
* options.insert should be an instance of function."
Expand All @@ -53,7 +53,7 @@ exports[`validate options should throw an error on the "insert" option with "1"
- options.insert should be one of these:
string | function
-> Inserts \`<link>\` at the given position.
-> Read more at https://webpack.js.org/plugins/mini-css-extract-plugin/#insert
-> Read more at https://github.com/webpack-contrib/mini-css-extract-plugin#insert
Details:
* options.insert should be a string.
* options.insert should be an instance of function."
Expand All @@ -64,7 +64,7 @@ exports[`validate options should throw an error on the "insert" option with "tru
- options.insert should be one of these:
string | function
-> Inserts \`<link>\` at the given position.
-> Read more at https://webpack.js.org/plugins/mini-css-extract-plugin/#insert
-> Read more at https://github.com/webpack-contrib/mini-css-extract-plugin#insert
Details:
* options.insert should be a string.
* options.insert should be an instance of function."
Expand All @@ -75,7 +75,7 @@ exports[`validate options should throw an error on the "linkType" option with "[
- options.linkType should be one of these:
\\"text/css\\" | boolean
-> This option allows loading asynchronous chunks with a custom link type
-> Read more at https://webpack.js.org/plugins/mini-css-extract-plugin/#linktype
-> Read more at https://github.com/webpack-contrib/mini-css-extract-plugin#linktype
Details:
* options.linkType should be \\"text/css\\".
* options.linkType should be a boolean."
Expand All @@ -86,7 +86,7 @@ exports[`validate options should throw an error on the "linkType" option with "{
- options.linkType should be one of these:
\\"text/css\\" | boolean
-> This option allows loading asynchronous chunks with a custom link type
-> Read more at https://webpack.js.org/plugins/mini-css-extract-plugin/#linktype
-> Read more at https://github.com/webpack-contrib/mini-css-extract-plugin#linktype
Details:
* options.linkType should be \\"text/css\\".
* options.linkType should be a boolean."
Expand All @@ -97,7 +97,7 @@ exports[`validate options should throw an error on the "linkType" option with "1
- options.linkType should be one of these:
\\"text/css\\" | boolean
-> This option allows loading asynchronous chunks with a custom link type
-> Read more at https://webpack.js.org/plugins/mini-css-extract-plugin/#linktype
-> Read more at https://github.com/webpack-contrib/mini-css-extract-plugin#linktype
Details:
* options.linkType should be \\"text/css\\".
* options.linkType should be a boolean."
Expand All @@ -108,7 +108,7 @@ exports[`validate options should throw an error on the "linkType" option with "i
- options.linkType should be one of these:
\\"text/css\\" | boolean
-> This option allows loading asynchronous chunks with a custom link type
-> Read more at https://webpack.js.org/plugins/mini-css-extract-plugin/#linktype
-> Read more at https://github.com/webpack-contrib/mini-css-extract-plugin#linktype
Details:
* options.linkType should be \\"text/css\\".
* options.linkType should be a boolean."
Expand Down