use dashes case

This commit is contained in:
ahabhgk 2024-02-21 19:48:51 +08:00
parent 47ce233333
commit f892acf0a2
16 changed files with 133 additions and 127 deletions

View File

@ -740,7 +740,7 @@ export type AssetParserDataUrlFunction = (
* Specifies the convention of exported names.
*/
export type CssGeneratorExportsConvention =
| ("asIs" | "camelCase" | "camelCaseOnly" | "dashes" | "dashesOnly")
| ("as-is" | "camel-case" | "camel-case-only" | "dashes" | "dashes-only")
| ((name: string) => string);
/**
* Avoid generating and loading a stylesheet and only embed exports from css into output javascript files.

View File

@ -554,7 +554,7 @@ const applyCssGeneratorOptionsDefaults = (
"exportsOnly",
!targetProperties || !targetProperties.document
);
D(generatorOptions, "exportsConvention", "asIs");
D(generatorOptions, "exportsConvention", "as-is");
};
/**

View File

@ -18,12 +18,12 @@ exports.cssExportConvention = (input, convention) => {
set.add(convention(input));
} else {
switch (convention) {
case "camelCase": {
case "camel-case": {
set.add(input);
set.add(exports.camelCase(input));
break;
}
case "camelCaseOnly": {
case "camel-case-only": {
set.add(exports.camelCase(input));
break;
}
@ -32,11 +32,11 @@ exports.cssExportConvention = (input, convention) => {
set.add(exports.dashesCamelCase(input));
break;
}
case "dashesOnly": {
case "dashes-only": {
set.add(exports.dashesCamelCase(input));
break;
}
case "asIs": {
case "as-is": {
set.add(input);
break;
}

File diff suppressed because one or more lines are too long

View File

@ -402,7 +402,13 @@
"description": "Specifies the convention of exported names.",
"anyOf": [
{
"enum": ["asIs", "camelCase", "camelCaseOnly", "dashes", "dashesOnly"]
"enum": [
"as-is",
"camel-case",
"camel-case-only",
"dashes",
"dashes-only"
]
},
{
"instanceof": "Function",

View File

@ -3,4 +3,4 @@
* DO NOT MODIFY BY HAND.
* Run `yarn special-lint-fix` to update
*/
"use strict";function r(t,{instancePath:e="",parentData:n,parentDataProperty:a,rootData:o=t}={}){let s=null,l=0;if(0===l){if(!t||"object"!=typeof t||Array.isArray(t))return r.errors=[{params:{type:"object"}}],!1;{const e=l;for(const e in t)if("exportsConvention"!==e&&"exportsOnly"!==e)return r.errors=[{params:{additionalProperty:e}}],!1;if(e===l){if(void 0!==t.exportsConvention){let e=t.exportsConvention;const n=l,a=l;let o=!1;const u=l;if("asIs"!==e&&"camelCase"!==e&&"camelCaseOnly"!==e&&"dashes"!==e&&"dashesOnly"!==e){const r={params:{}};null===s?s=[r]:s.push(r),l++}var p=u===l;if(o=o||p,!o){const r=l;if(!(e instanceof Function)){const r={params:{}};null===s?s=[r]:s.push(r),l++}p=r===l,o=o||p}if(!o){const t={params:{}};return null===s?s=[t]:s.push(t),l++,r.errors=s,!1}l=a,null!==s&&(a?s.length=a:s=null);var i=n===l}else i=!0;if(i)if(void 0!==t.exportsOnly){const e=l;if("boolean"!=typeof t.exportsOnly)return r.errors=[{params:{type:"boolean"}}],!1;i=e===l}else i=!0}}}return r.errors=s,0===l}function t(e,{instancePath:n="",parentData:a,parentDataProperty:o,rootData:s=e}={}){let l=null,p=0;return r(e,{instancePath:n,parentData:a,parentDataProperty:o,rootData:s})||(l=null===l?r.errors:l.concat(r.errors),p=l.length),t.errors=l,0===p}module.exports=t,module.exports.default=t;
"use strict";function r(t,{instancePath:e="",parentData:n,parentDataProperty:o,rootData:a=t}={}){let s=null,l=0;if(0===l){if(!t||"object"!=typeof t||Array.isArray(t))return r.errors=[{params:{type:"object"}}],!1;{const e=l;for(const e in t)if("exportsConvention"!==e&&"exportsOnly"!==e)return r.errors=[{params:{additionalProperty:e}}],!1;if(e===l){if(void 0!==t.exportsConvention){let e=t.exportsConvention;const n=l,o=l;let a=!1;const c=l;if("as-is"!==e&&"camel-case"!==e&&"camel-case-only"!==e&&"dashes"!==e&&"dashes-only"!==e){const r={params:{}};null===s?s=[r]:s.push(r),l++}var p=c===l;if(a=a||p,!a){const r=l;if(!(e instanceof Function)){const r={params:{}};null===s?s=[r]:s.push(r),l++}p=r===l,a=a||p}if(!a){const t={params:{}};return null===s?s=[t]:s.push(t),l++,r.errors=s,!1}l=o,null!==s&&(o?s.length=o:s=null);var i=n===l}else i=!0;if(i)if(void 0!==t.exportsOnly){const e=l;if("boolean"!=typeof t.exportsOnly)return r.errors=[{params:{type:"boolean"}}],!1;i=e===l}else i=!0}}}return r.errors=s,0===l}function t(e,{instancePath:n="",parentData:o,parentDataProperty:a,rootData:s=e}={}){let l=null,p=0;return r(e,{instancePath:n,parentData:o,parentDataProperty:a,rootData:s})||(l=null===l?r.errors:l.concat(r.errors),p=l.length),t.errors=l,0===p}module.exports=t,module.exports.default=t;

View File

@ -3,4 +3,4 @@
* DO NOT MODIFY BY HAND.
* Run `yarn special-lint-fix` to update
*/
"use strict";function r(t,{instancePath:e="",parentData:n,parentDataProperty:a,rootData:o=t}={}){let s=null,l=0;if(0===l){if(!t||"object"!=typeof t||Array.isArray(t))return r.errors=[{params:{type:"object"}}],!1;{const e=l;for(const e in t)if("exportsConvention"!==e&&"exportsOnly"!==e)return r.errors=[{params:{additionalProperty:e}}],!1;if(e===l){if(void 0!==t.exportsConvention){let e=t.exportsConvention;const n=l,a=l;let o=!1;const u=l;if("asIs"!==e&&"camelCase"!==e&&"camelCaseOnly"!==e&&"dashes"!==e&&"dashesOnly"!==e){const r={params:{}};null===s?s=[r]:s.push(r),l++}var p=u===l;if(o=o||p,!o){const r=l;if(!(e instanceof Function)){const r={params:{}};null===s?s=[r]:s.push(r),l++}p=r===l,o=o||p}if(!o){const t={params:{}};return null===s?s=[t]:s.push(t),l++,r.errors=s,!1}l=a,null!==s&&(a?s.length=a:s=null);var i=n===l}else i=!0;if(i)if(void 0!==t.exportsOnly){const e=l;if("boolean"!=typeof t.exportsOnly)return r.errors=[{params:{type:"boolean"}}],!1;i=e===l}else i=!0}}}return r.errors=s,0===l}function t(e,{instancePath:n="",parentData:a,parentDataProperty:o,rootData:s=e}={}){let l=null,p=0;return r(e,{instancePath:n,parentData:a,parentDataProperty:o,rootData:s})||(l=null===l?r.errors:l.concat(r.errors),p=l.length),t.errors=l,0===p}module.exports=t,module.exports.default=t;
"use strict";function r(t,{instancePath:e="",parentData:n,parentDataProperty:o,rootData:a=t}={}){let s=null,l=0;if(0===l){if(!t||"object"!=typeof t||Array.isArray(t))return r.errors=[{params:{type:"object"}}],!1;{const e=l;for(const e in t)if("exportsConvention"!==e&&"exportsOnly"!==e)return r.errors=[{params:{additionalProperty:e}}],!1;if(e===l){if(void 0!==t.exportsConvention){let e=t.exportsConvention;const n=l,o=l;let a=!1;const c=l;if("as-is"!==e&&"camel-case"!==e&&"camel-case-only"!==e&&"dashes"!==e&&"dashes-only"!==e){const r={params:{}};null===s?s=[r]:s.push(r),l++}var p=c===l;if(a=a||p,!a){const r=l;if(!(e instanceof Function)){const r={params:{}};null===s?s=[r]:s.push(r),l++}p=r===l,a=a||p}if(!a){const t={params:{}};return null===s?s=[t]:s.push(t),l++,r.errors=s,!1}l=o,null!==s&&(o?s.length=o:s=null);var i=n===l}else i=!0;if(i)if(void 0!==t.exportsOnly){const e=l;if("boolean"!=typeof t.exportsOnly)return r.errors=[{params:{type:"boolean"}}],!1;i=e===l}else i=!0}}}return r.errors=s,0===l}function t(e,{instancePath:n="",parentData:o,parentDataProperty:a,rootData:s=e}={}){let l=null,p=0;return r(e,{instancePath:n,parentData:o,parentDataProperty:a,rootData:s})||(l=null===l?r.errors:l.concat(r.errors),p=l.length),t.errors=l,0===p}module.exports=t,module.exports.default=t;

View File

@ -3,4 +3,4 @@
* DO NOT MODIFY BY HAND.
* Run `yarn special-lint-fix` to update
*/
"use strict";function r(t,{instancePath:e="",parentData:n,parentDataProperty:a,rootData:o=t}={}){let s=null,l=0;if(0===l){if(!t||"object"!=typeof t||Array.isArray(t))return r.errors=[{params:{type:"object"}}],!1;{const e=l;for(const e in t)if("exportsConvention"!==e&&"exportsOnly"!==e)return r.errors=[{params:{additionalProperty:e}}],!1;if(e===l){if(void 0!==t.exportsConvention){let e=t.exportsConvention;const n=l,a=l;let o=!1;const u=l;if("asIs"!==e&&"camelCase"!==e&&"camelCaseOnly"!==e&&"dashes"!==e&&"dashesOnly"!==e){const r={params:{}};null===s?s=[r]:s.push(r),l++}var p=u===l;if(o=o||p,!o){const r=l;if(!(e instanceof Function)){const r={params:{}};null===s?s=[r]:s.push(r),l++}p=r===l,o=o||p}if(!o){const t={params:{}};return null===s?s=[t]:s.push(t),l++,r.errors=s,!1}l=a,null!==s&&(a?s.length=a:s=null);var i=n===l}else i=!0;if(i)if(void 0!==t.exportsOnly){const e=l;if("boolean"!=typeof t.exportsOnly)return r.errors=[{params:{type:"boolean"}}],!1;i=e===l}else i=!0}}}return r.errors=s,0===l}function t(e,{instancePath:n="",parentData:a,parentDataProperty:o,rootData:s=e}={}){let l=null,p=0;return r(e,{instancePath:n,parentData:a,parentDataProperty:o,rootData:s})||(l=null===l?r.errors:l.concat(r.errors),p=l.length),t.errors=l,0===p}module.exports=t,module.exports.default=t;
"use strict";function r(t,{instancePath:e="",parentData:n,parentDataProperty:o,rootData:a=t}={}){let s=null,l=0;if(0===l){if(!t||"object"!=typeof t||Array.isArray(t))return r.errors=[{params:{type:"object"}}],!1;{const e=l;for(const e in t)if("exportsConvention"!==e&&"exportsOnly"!==e)return r.errors=[{params:{additionalProperty:e}}],!1;if(e===l){if(void 0!==t.exportsConvention){let e=t.exportsConvention;const n=l,o=l;let a=!1;const c=l;if("as-is"!==e&&"camel-case"!==e&&"camel-case-only"!==e&&"dashes"!==e&&"dashes-only"!==e){const r={params:{}};null===s?s=[r]:s.push(r),l++}var p=c===l;if(a=a||p,!a){const r=l;if(!(e instanceof Function)){const r={params:{}};null===s?s=[r]:s.push(r),l++}p=r===l,a=a||p}if(!a){const t={params:{}};return null===s?s=[t]:s.push(t),l++,r.errors=s,!1}l=o,null!==s&&(o?s.length=o:s=null);var i=n===l}else i=!0;if(i)if(void 0!==t.exportsOnly){const e=l;if("boolean"!=typeof t.exportsOnly)return r.errors=[{params:{type:"boolean"}}],!1;i=e===l}else i=!0}}}return r.errors=s,0===l}function t(e,{instancePath:n="",parentData:o,parentDataProperty:a,rootData:s=e}={}){let l=null,p=0;return r(e,{instancePath:n,parentData:o,parentDataProperty:a,rootData:s})||(l=null===l?r.errors:l.concat(r.errors),p=l.length),t.errors=l,0===p}module.exports=t,module.exports.default=t;

View File

@ -3,4 +3,4 @@
* DO NOT MODIFY BY HAND.
* Run `yarn special-lint-fix` to update
*/
"use strict";function r(t,{instancePath:e="",parentData:n,parentDataProperty:a,rootData:o=t}={}){let s=null,l=0;if(0===l){if(!t||"object"!=typeof t||Array.isArray(t))return r.errors=[{params:{type:"object"}}],!1;{const e=l;for(const e in t)if("exportsConvention"!==e&&"exportsOnly"!==e)return r.errors=[{params:{additionalProperty:e}}],!1;if(e===l){if(void 0!==t.exportsConvention){let e=t.exportsConvention;const n=l,a=l;let o=!1;const u=l;if("asIs"!==e&&"camelCase"!==e&&"camelCaseOnly"!==e&&"dashes"!==e&&"dashesOnly"!==e){const r={params:{}};null===s?s=[r]:s.push(r),l++}var p=u===l;if(o=o||p,!o){const r=l;if(!(e instanceof Function)){const r={params:{}};null===s?s=[r]:s.push(r),l++}p=r===l,o=o||p}if(!o){const t={params:{}};return null===s?s=[t]:s.push(t),l++,r.errors=s,!1}l=a,null!==s&&(a?s.length=a:s=null);var i=n===l}else i=!0;if(i)if(void 0!==t.exportsOnly){const e=l;if("boolean"!=typeof t.exportsOnly)return r.errors=[{params:{type:"boolean"}}],!1;i=e===l}else i=!0}}}return r.errors=s,0===l}function t(e,{instancePath:n="",parentData:a,parentDataProperty:o,rootData:s=e}={}){let l=null,p=0;return r(e,{instancePath:n,parentData:a,parentDataProperty:o,rootData:s})||(l=null===l?r.errors:l.concat(r.errors),p=l.length),t.errors=l,0===p}module.exports=t,module.exports.default=t;
"use strict";function r(t,{instancePath:e="",parentData:n,parentDataProperty:o,rootData:a=t}={}){let s=null,l=0;if(0===l){if(!t||"object"!=typeof t||Array.isArray(t))return r.errors=[{params:{type:"object"}}],!1;{const e=l;for(const e in t)if("exportsConvention"!==e&&"exportsOnly"!==e)return r.errors=[{params:{additionalProperty:e}}],!1;if(e===l){if(void 0!==t.exportsConvention){let e=t.exportsConvention;const n=l,o=l;let a=!1;const c=l;if("as-is"!==e&&"camel-case"!==e&&"camel-case-only"!==e&&"dashes"!==e&&"dashes-only"!==e){const r={params:{}};null===s?s=[r]:s.push(r),l++}var p=c===l;if(a=a||p,!a){const r=l;if(!(e instanceof Function)){const r={params:{}};null===s?s=[r]:s.push(r),l++}p=r===l,a=a||p}if(!a){const t={params:{}};return null===s?s=[t]:s.push(t),l++,r.errors=s,!1}l=o,null!==s&&(o?s.length=o:s=null);var i=n===l}else i=!0;if(i)if(void 0!==t.exportsOnly){const e=l;if("boolean"!=typeof t.exportsOnly)return r.errors=[{params:{type:"boolean"}}],!1;i=e===l}else i=!0}}}return r.errors=s,0===l}function t(e,{instancePath:n="",parentData:o,parentDataProperty:a,rootData:s=e}={}){let l=null,p=0;return r(e,{instancePath:n,parentData:o,parentDataProperty:a,rootData:s})||(l=null===l?r.errors:l.concat(r.errors),p=l.length),t.errors=l,0===p}module.exports=t,module.exports.default=t;

View File

@ -2271,7 +2271,7 @@ describe("snapshots", () => {
- "generator": Object {},
+ "generator": Object {
+ "css": Object {
+ "exportsConvention": "asIs",
+ "exportsConvention": "as-is",
+ "exportsOnly": false,
+ },
+ },

View File

@ -1437,11 +1437,11 @@ Object {
"path": "module.generator.css/auto.exportsConvention",
"type": "enum",
"values": Array [
"asIs",
"camelCase",
"camelCaseOnly",
"as-is",
"camel-case",
"camel-case-only",
"dashes",
"dashesOnly",
"dashes-only",
],
},
],
@ -1470,11 +1470,11 @@ Object {
"path": "module.generator.css.exportsConvention",
"type": "enum",
"values": Array [
"asIs",
"camelCase",
"camelCaseOnly",
"as-is",
"camel-case",
"camel-case-only",
"dashes",
"dashesOnly",
"dashes-only",
],
},
],
@ -1503,11 +1503,11 @@ Object {
"path": "module.generator.css/global.exportsConvention",
"type": "enum",
"values": Array [
"asIs",
"camelCase",
"camelCaseOnly",
"as-is",
"camel-case",
"camel-case-only",
"dashes",
"dashesOnly",
"dashes-only",
],
},
],
@ -1536,11 +1536,11 @@ Object {
"path": "module.generator.css/module.exportsConvention",
"type": "enum",
"values": Array [
"asIs",
"camelCase",
"camelCaseOnly",
"as-is",
"camel-case",
"camel-case-only",
"dashes",
"dashesOnly",
"dashes-only",
],
},
],

View File

@ -2830,38 +2830,38 @@ exports[`ConfigCacheTestCases css css-modules-in-node exported tests should allo
exports[`ConfigCacheTestCases css exports-convention exported tests should have correct convention for css exports name 1`] = `
Object {
"btn--info_is-disabled_1": "./style.module.css?asIs-btn--info_is-disabled_1",
"btn-info_is-disabled": "./style.module.css?asIs-btn-info_is-disabled",
"btn--info_is-disabled_1": "./style.module.css?as-is-btn--info_is-disabled_1",
"btn-info_is-disabled": "./style.module.css?as-is-btn-info_is-disabled",
"foo": "bar",
"foo_bar": "./style.module.css?asIs-foo_bar",
"foo_bar": "./style.module.css?as-is-foo_bar",
"my-btn-info_is-disabled": "value",
"simple": "./style.module.css?asIs-simple",
"simple": "./style.module.css?as-is-simple",
}
`;
exports[`ConfigCacheTestCases css exports-convention exported tests should have correct convention for css exports name 2`] = `
Object {
"btn--info_is-disabled_1": "./style.module.css?camelCase-btn--info_is-disabled_1",
"btn-info_is-disabled": "./style.module.css?camelCase-btn-info_is-disabled",
"btnInfoIsDisabled": "./style.module.css?camelCase-btn-info_is-disabled",
"btnInfoIsDisabled1": "./style.module.css?camelCase-btn--info_is-disabled_1",
"btn--info_is-disabled_1": "./style.module.css?camel-case-btn--info_is-disabled_1",
"btn-info_is-disabled": "./style.module.css?camel-case-btn-info_is-disabled",
"btnInfoIsDisabled": "./style.module.css?camel-case-btn-info_is-disabled",
"btnInfoIsDisabled1": "./style.module.css?camel-case-btn--info_is-disabled_1",
"foo": "bar",
"fooBar": "./style.module.css?camelCase-foo_bar",
"foo_bar": "./style.module.css?camelCase-foo_bar",
"fooBar": "./style.module.css?camel-case-foo_bar",
"foo_bar": "./style.module.css?camel-case-foo_bar",
"my-btn-info_is-disabled": "value",
"myBtnInfoIsDisabled": "value",
"simple": "./style.module.css?camelCase-simple",
"simple": "./style.module.css?camel-case-simple",
}
`;
exports[`ConfigCacheTestCases css exports-convention exported tests should have correct convention for css exports name 3`] = `
Object {
"btnInfoIsDisabled": "./style.module.css?camelCaseOnly-btn-info_is-disabled",
"btnInfoIsDisabled1": "./style.module.css?camelCaseOnly-btn--info_is-disabled_1",
"btnInfoIsDisabled": "./style.module.css?camel-case-only-btn-info_is-disabled",
"btnInfoIsDisabled1": "./style.module.css?camel-case-only-btn--info_is-disabled_1",
"foo": "bar",
"fooBar": "./style.module.css?camelCaseOnly-foo_bar",
"fooBar": "./style.module.css?camel-case-only-foo_bar",
"myBtnInfoIsDisabled": "value",
"simple": "./style.module.css?camelCaseOnly-simple",
"simple": "./style.module.css?camel-case-only-simple",
}
`;
@ -2881,12 +2881,12 @@ Object {
exports[`ConfigCacheTestCases css exports-convention exported tests should have correct convention for css exports name 5`] = `
Object {
"btnInfo_isDisabled": "./style.module.css?dashesOnly-btn-info_is-disabled",
"btnInfo_isDisabled_1": "./style.module.css?dashesOnly-btn--info_is-disabled_1",
"btnInfo_isDisabled": "./style.module.css?dashes-only-btn-info_is-disabled",
"btnInfo_isDisabled_1": "./style.module.css?dashes-only-btn--info_is-disabled_1",
"foo": "bar",
"foo_bar": "./style.module.css?dashesOnly-foo_bar",
"foo_bar": "./style.module.css?dashes-only-foo_bar",
"myBtnInfo_isDisabled": "value",
"simple": "./style.module.css?dashesOnly-simple",
"simple": "./style.module.css?dashes-only-simple",
}
`;
@ -2903,34 +2903,34 @@ Object {
exports[`ConfigCacheTestCases css exports-convention exported tests should have correct convention for css exports name 7`] = `
Object {
"btn--info_is-disabled_1": "./style.module.css?asIs-btn--info_is-disabled_1",
"btn-info_is-disabled": "./style.module.css?asIs-btn-info_is-disabled",
"btn--info_is-disabled_1": "./style.module.css?as-is-btn--info_is-disabled_1",
"btn-info_is-disabled": "./style.module.css?as-is-btn-info_is-disabled",
"foo": "bar",
"foo_bar": "./style.module.css?asIs-foo_bar",
"foo_bar": "./style.module.css?as-is-foo_bar",
"my-btn-info_is-disabled": "value",
"simple": "./style.module.css?asIs-simple",
"simple": "./style.module.css?as-is-simple",
}
`;
exports[`ConfigCacheTestCases css exports-convention exported tests should have correct convention for css exports name 8`] = `
Object {
"btn--info_is-disabled_1": "./style.module.css?camelCase-btn--info_is-disabled_1",
"btn-info_is-disabled": "./style.module.css?camelCase-btn-info_is-disabled",
"btn--info_is-disabled_1": "./style.module.css?camel-case-btn--info_is-disabled_1",
"btn-info_is-disabled": "./style.module.css?camel-case-btn-info_is-disabled",
"foo": "bar",
"foo_bar": "./style.module.css?camelCase-foo_bar",
"foo_bar": "./style.module.css?camel-case-foo_bar",
"my-btn-info_is-disabled": "value",
"simple": "./style.module.css?camelCase-simple",
"simple": "./style.module.css?camel-case-simple",
}
`;
exports[`ConfigCacheTestCases css exports-convention exported tests should have correct convention for css exports name 9`] = `
Object {
"btn--info_is-disabled_1": "./style.module.css?camelCaseOnly-btn--info_is-disabled_1",
"btn-info_is-disabled": "./style.module.css?camelCaseOnly-btn-info_is-disabled",
"btn--info_is-disabled_1": "./style.module.css?camel-case-only-btn--info_is-disabled_1",
"btn-info_is-disabled": "./style.module.css?camel-case-only-btn-info_is-disabled",
"foo": "bar",
"foo_bar": "./style.module.css?camelCaseOnly-foo_bar",
"foo_bar": "./style.module.css?camel-case-only-foo_bar",
"my-btn-info_is-disabled": "value",
"simple": "./style.module.css?camelCaseOnly-simple",
"simple": "./style.module.css?camel-case-only-simple",
}
`;
@ -2947,12 +2947,12 @@ Object {
exports[`ConfigCacheTestCases css exports-convention exported tests should have correct convention for css exports name 11`] = `
Object {
"btn--info_is-disabled_1": "./style.module.css?dashesOnly-btn--info_is-disabled_1",
"btn-info_is-disabled": "./style.module.css?dashesOnly-btn-info_is-disabled",
"btn--info_is-disabled_1": "./style.module.css?dashes-only-btn--info_is-disabled_1",
"btn-info_is-disabled": "./style.module.css?dashes-only-btn-info_is-disabled",
"foo": "bar",
"foo_bar": "./style.module.css?dashesOnly-foo_bar",
"foo_bar": "./style.module.css?dashes-only-foo_bar",
"my-btn-info_is-disabled": "value",
"simple": "./style.module.css?dashesOnly-simple",
"simple": "./style.module.css?dashes-only-simple",
}
`;

View File

@ -2830,38 +2830,38 @@ exports[`ConfigTestCases css css-modules-in-node exported tests should allow to
exports[`ConfigTestCases css exports-convention exported tests should have correct convention for css exports name 1`] = `
Object {
"btn--info_is-disabled_1": "./style.module.css?asIs-btn--info_is-disabled_1",
"btn-info_is-disabled": "./style.module.css?asIs-btn-info_is-disabled",
"btn--info_is-disabled_1": "./style.module.css?as-is-btn--info_is-disabled_1",
"btn-info_is-disabled": "./style.module.css?as-is-btn-info_is-disabled",
"foo": "bar",
"foo_bar": "./style.module.css?asIs-foo_bar",
"foo_bar": "./style.module.css?as-is-foo_bar",
"my-btn-info_is-disabled": "value",
"simple": "./style.module.css?asIs-simple",
"simple": "./style.module.css?as-is-simple",
}
`;
exports[`ConfigTestCases css exports-convention exported tests should have correct convention for css exports name 2`] = `
Object {
"btn--info_is-disabled_1": "./style.module.css?camelCase-btn--info_is-disabled_1",
"btn-info_is-disabled": "./style.module.css?camelCase-btn-info_is-disabled",
"btnInfoIsDisabled": "./style.module.css?camelCase-btn-info_is-disabled",
"btnInfoIsDisabled1": "./style.module.css?camelCase-btn--info_is-disabled_1",
"btn--info_is-disabled_1": "./style.module.css?camel-case-btn--info_is-disabled_1",
"btn-info_is-disabled": "./style.module.css?camel-case-btn-info_is-disabled",
"btnInfoIsDisabled": "./style.module.css?camel-case-btn-info_is-disabled",
"btnInfoIsDisabled1": "./style.module.css?camel-case-btn--info_is-disabled_1",
"foo": "bar",
"fooBar": "./style.module.css?camelCase-foo_bar",
"foo_bar": "./style.module.css?camelCase-foo_bar",
"fooBar": "./style.module.css?camel-case-foo_bar",
"foo_bar": "./style.module.css?camel-case-foo_bar",
"my-btn-info_is-disabled": "value",
"myBtnInfoIsDisabled": "value",
"simple": "./style.module.css?camelCase-simple",
"simple": "./style.module.css?camel-case-simple",
}
`;
exports[`ConfigTestCases css exports-convention exported tests should have correct convention for css exports name 3`] = `
Object {
"btnInfoIsDisabled": "./style.module.css?camelCaseOnly-btn-info_is-disabled",
"btnInfoIsDisabled1": "./style.module.css?camelCaseOnly-btn--info_is-disabled_1",
"btnInfoIsDisabled": "./style.module.css?camel-case-only-btn-info_is-disabled",
"btnInfoIsDisabled1": "./style.module.css?camel-case-only-btn--info_is-disabled_1",
"foo": "bar",
"fooBar": "./style.module.css?camelCaseOnly-foo_bar",
"fooBar": "./style.module.css?camel-case-only-foo_bar",
"myBtnInfoIsDisabled": "value",
"simple": "./style.module.css?camelCaseOnly-simple",
"simple": "./style.module.css?camel-case-only-simple",
}
`;
@ -2881,12 +2881,12 @@ Object {
exports[`ConfigTestCases css exports-convention exported tests should have correct convention for css exports name 5`] = `
Object {
"btnInfo_isDisabled": "./style.module.css?dashesOnly-btn-info_is-disabled",
"btnInfo_isDisabled_1": "./style.module.css?dashesOnly-btn--info_is-disabled_1",
"btnInfo_isDisabled": "./style.module.css?dashes-only-btn-info_is-disabled",
"btnInfo_isDisabled_1": "./style.module.css?dashes-only-btn--info_is-disabled_1",
"foo": "bar",
"foo_bar": "./style.module.css?dashesOnly-foo_bar",
"foo_bar": "./style.module.css?dashes-only-foo_bar",
"myBtnInfo_isDisabled": "value",
"simple": "./style.module.css?dashesOnly-simple",
"simple": "./style.module.css?dashes-only-simple",
}
`;
@ -2903,34 +2903,34 @@ Object {
exports[`ConfigTestCases css exports-convention exported tests should have correct convention for css exports name 7`] = `
Object {
"btn--info_is-disabled_1": "./style.module.css?asIs-btn--info_is-disabled_1",
"btn-info_is-disabled": "./style.module.css?asIs-btn-info_is-disabled",
"btn--info_is-disabled_1": "./style.module.css?as-is-btn--info_is-disabled_1",
"btn-info_is-disabled": "./style.module.css?as-is-btn-info_is-disabled",
"foo": "bar",
"foo_bar": "./style.module.css?asIs-foo_bar",
"foo_bar": "./style.module.css?as-is-foo_bar",
"my-btn-info_is-disabled": "value",
"simple": "./style.module.css?asIs-simple",
"simple": "./style.module.css?as-is-simple",
}
`;
exports[`ConfigTestCases css exports-convention exported tests should have correct convention for css exports name 8`] = `
Object {
"btn--info_is-disabled_1": "./style.module.css?camelCase-btn--info_is-disabled_1",
"btn-info_is-disabled": "./style.module.css?camelCase-btn-info_is-disabled",
"btn--info_is-disabled_1": "./style.module.css?camel-case-btn--info_is-disabled_1",
"btn-info_is-disabled": "./style.module.css?camel-case-btn-info_is-disabled",
"foo": "bar",
"foo_bar": "./style.module.css?camelCase-foo_bar",
"foo_bar": "./style.module.css?camel-case-foo_bar",
"my-btn-info_is-disabled": "value",
"simple": "./style.module.css?camelCase-simple",
"simple": "./style.module.css?camel-case-simple",
}
`;
exports[`ConfigTestCases css exports-convention exported tests should have correct convention for css exports name 9`] = `
Object {
"btn--info_is-disabled_1": "./style.module.css?camelCaseOnly-btn--info_is-disabled_1",
"btn-info_is-disabled": "./style.module.css?camelCaseOnly-btn-info_is-disabled",
"btn--info_is-disabled_1": "./style.module.css?camel-case-only-btn--info_is-disabled_1",
"btn-info_is-disabled": "./style.module.css?camel-case-only-btn-info_is-disabled",
"foo": "bar",
"foo_bar": "./style.module.css?camelCaseOnly-foo_bar",
"foo_bar": "./style.module.css?camel-case-only-foo_bar",
"my-btn-info_is-disabled": "value",
"simple": "./style.module.css?camelCaseOnly-simple",
"simple": "./style.module.css?camel-case-only-simple",
}
`;
@ -2947,12 +2947,12 @@ Object {
exports[`ConfigTestCases css exports-convention exported tests should have correct convention for css exports name 11`] = `
Object {
"btn--info_is-disabled_1": "./style.module.css?dashesOnly-btn--info_is-disabled_1",
"btn-info_is-disabled": "./style.module.css?dashesOnly-btn-info_is-disabled",
"btn--info_is-disabled_1": "./style.module.css?dashes-only-btn--info_is-disabled_1",
"btn-info_is-disabled": "./style.module.css?dashes-only-btn-info_is-disabled",
"foo": "bar",
"foo_bar": "./style.module.css?dashesOnly-foo_bar",
"foo_bar": "./style.module.css?dashes-only-foo_bar",
"my-btn-info_is-disabled": "value",
"simple": "./style.module.css?dashesOnly-simple",
"simple": "./style.module.css?dashes-only-simple",
}
`;

View File

@ -1,10 +1,10 @@
it("should have correct convention for css exports name", (done) => {
Promise.all([
import("./style.module.css?asIs"),
import("./style.module.css?camelCase"),
import("./style.module.css?camelCaseOnly"),
import("./style.module.css?as-is"),
import("./style.module.css?camel-case"),
import("./style.module.css?camel-case-only"),
import("./style.module.css?dashes"),
import("./style.module.css?dashesOnly"),
import("./style.module.css?dashes-only"),
import("./style.module.css?upper"),
]).then(([asIs, camelCase, camelCaseOnly, dashes, dashesOnly, upper]) => {
expect(asIs).toMatchSnapshot();

View File

@ -7,21 +7,21 @@ const common = {
type: "css/module",
oneOf: [
{
resourceQuery: /\?asIs$/,
resourceQuery: /\?as-is$/,
generator: {
exportsConvention: "asIs"
exportsConvention: "as-is"
}
},
{
resourceQuery: /\?camelCase$/,
resourceQuery: /\?camel-case$/,
generator: {
exportsConvention: "camelCase"
exportsConvention: "camel-case"
}
},
{
resourceQuery: /\?camelCaseOnly$/,
resourceQuery: /\?camel-case-only$/,
generator: {
exportsConvention: "camelCaseOnly"
exportsConvention: "camel-case-only"
}
},
{
@ -31,9 +31,9 @@ const common = {
}
},
{
resourceQuery: /\?dashesOnly$/,
resourceQuery: /\?dashes-only$/,
generator: {
exportsConvention: "dashesOnly"
exportsConvention: "dashes-only"
}
},
{

32
types.d.ts vendored
View File

@ -2900,11 +2900,11 @@ declare interface CssAutoGeneratorOptions {
* Specifies the convention of exported names.
*/
exportsConvention?:
| "asIs"
| "camelCase"
| "camelCaseOnly"
| "as-is"
| "camel-case"
| "camel-case-only"
| "dashes"
| "dashesOnly"
| "dashes-only"
| ((name: string) => string);
/**
@ -2931,11 +2931,11 @@ declare interface CssGeneratorOptions {
* Specifies the convention of exported names.
*/
exportsConvention?:
| "asIs"
| "camelCase"
| "camelCaseOnly"
| "as-is"
| "camel-case"
| "camel-case-only"
| "dashes"
| "dashesOnly"
| "dashes-only"
| ((name: string) => string);
/**
@ -2952,11 +2952,11 @@ declare interface CssGlobalGeneratorOptions {
* Specifies the convention of exported names.
*/
exportsConvention?:
| "asIs"
| "camelCase"
| "camelCaseOnly"
| "as-is"
| "camel-case"
| "camel-case-only"
| "dashes"
| "dashesOnly"
| "dashes-only"
| ((name: string) => string);
/**
@ -2983,11 +2983,11 @@ declare interface CssModuleGeneratorOptions {
* Specifies the convention of exported names.
*/
exportsConvention?:
| "asIs"
| "camelCase"
| "camelCaseOnly"
| "as-is"
| "camel-case"
| "camel-case-only"
| "dashes"
| "dashesOnly"
| "dashes-only"
| ((name: string) => string);
/**