Skip to content
This repository was archived by the owner on Dec 6, 2021. It is now read-only.

Commit 5567a8c

Browse files
authored
feat: CSS modules should export camelCased names (#585)
* export camelcased names * tweaks * add repository info * remove allowBranch config
1 parent 3e6c9d2 commit 5567a8c

File tree

6 files changed

+58
-40
lines changed

6 files changed

+58
-40
lines changed

core/poi/lib/plugins/config-css.js

+7-3
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,17 @@ exports.apply = api => {
8181
const cssLoaderOptions = Object.assign(
8282
{
8383
sourceMap,
84-
modules,
85-
localIdentName: '[name]_[local]_[hash:base64:5]',
84+
modules: modules
85+
? {
86+
localIdentName: '[name]_[local]_[hash:base64:5]'
87+
}
88+
: false,
8689
importLoaders:
8790
1 + // stylePostLoader injected by vue-loader
8891
(hasPostCSSConfig ? 1 : 0) +
8992
(needInlineMinification ? 1 : 0),
90-
exportOnlyLocals: isServer
93+
onlyLocals: isServer,
94+
localsConvention: 'camelCase'
9195
},
9296
loaderOptions.css
9397
)

core/poi/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
"case-sensitive-paths-webpack-plugin": "^2.1.2",
4444
"chalk": "^2.4.1",
4545
"copy-webpack-plugin": "^5.1.1",
46-
"css-loader": "^2.1.1",
46+
"css-loader": "^3.0.0",
4747
"cssnano": "^4.1.7",
4848
"dotenv": "^8.1.0",
4949
"dotenv-expand": "^4.2.0",

lerna.json

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
"ignoreChanges": ["**/__fixtures__/**", "**/__tests__/**", "**/*.md"],
77
"command": {
88
"publish": {
9-
"allowBranch": ["master"],
109
"message": "chore(release): publish"
1110
}
1211
}

package.json

+4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
"commit": "git-cz",
88
"release": "lerna version --conventional-commits"
99
},
10+
"repository": {
11+
"type": "git",
12+
"url": "[email protected]:egoist/poi.git"
13+
},
1014
"workspaces": [
1115
"core/*",
1216
"plugins/*",

plugins/astroturf/index.test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ test('astroturf', async () => {
4141
await project.run('poi')
4242
expect(project.require('dist/index.js')).toEqual({
4343
default: {
44-
box: 'index-styles-module_box_1SCdY',
45-
footer: 'index-styles-module_footer_1xrFU'
44+
box: 'index-styles.module_box_1SCdY',
45+
footer: 'index-styles.module_footer_1xrFU'
4646
}
4747
})
4848
})

yarn.lock

+44-33
Original file line numberDiff line numberDiff line change
@@ -4837,21 +4837,22 @@ css-declaration-sorter@^4.0.1:
48374837
postcss "^7.0.1"
48384838
timsort "^0.3.0"
48394839

4840-
css-loader@^2.1.1:
4841-
version "2.1.1"
4842-
resolved "https://registry.yarnpkg.com/css-loader/-/css-loader-2.1.1.tgz#d8254f72e412bb2238bb44dd674ffbef497333ea"
4843-
integrity sha512-OcKJU/lt232vl1P9EEDamhoO9iKY3tIjY5GU+XDLblAykTdgs6Ux9P1hTHve8nFKy5KPpOXOsVI/hIwi3841+w==
4840+
css-loader@^3.0.0:
4841+
version "3.0.0"
4842+
resolved "https://registry.yarnpkg.com/css-loader/-/css-loader-3.0.0.tgz#bdd48a4921eefedf1f0a55266585944d4e5efc63"
4843+
integrity sha512-WR6KZuCkFbnMhRrGPlkwAA7SSCtwqPwpyXJAPhotYkYsc0mKU9n/fu5wufy4jl2WhBw9Ia8gUQMIp/1w98DuPw==
48444844
dependencies:
4845-
camelcase "^5.2.0"
4846-
icss-utils "^4.1.0"
4845+
camelcase "^5.3.1"
4846+
cssesc "^3.0.0"
4847+
icss-utils "^4.1.1"
48474848
loader-utils "^1.2.3"
48484849
normalize-path "^3.0.0"
4849-
postcss "^7.0.14"
4850+
postcss "^7.0.17"
48504851
postcss-modules-extract-imports "^2.0.0"
4851-
postcss-modules-local-by-default "^2.0.6"
4852+
postcss-modules-local-by-default "^3.0.2"
48524853
postcss-modules-scope "^2.1.0"
4853-
postcss-modules-values "^2.0.0"
4854-
postcss-value-parser "^3.3.0"
4854+
postcss-modules-values "^3.0.0"
4855+
postcss-value-parser "^4.0.0"
48554856
schema-utils "^1.0.0"
48564857

48574858
css-select-base-adapter@~0.1.0:
@@ -7904,15 +7905,10 @@ [email protected], iconv-lite@^0.4.24, iconv-lite@^0.4.4, iconv-lite@~0.4.13:
79047905
dependencies:
79057906
safer-buffer ">= 2.1.2 < 3"
79067907

7907-
icss-replace-symbols@^1.1.0:
7908-
version "1.1.0"
7909-
resolved "https://registry.npmjs.org/icss-replace-symbols/-/icss-replace-symbols-1.1.0.tgz#06ea6f83679a7749e386cfe1fe812ae5db223ded"
7910-
integrity sha1-Bupvg2ead0njhs/h/oEq5dsiPe0=
7911-
7912-
icss-utils@^4.1.0:
7913-
version "4.1.0"
7914-
resolved "https://registry.yarnpkg.com/icss-utils/-/icss-utils-4.1.0.tgz#339dbbffb9f8729a243b701e1c29d4cc58c52f0e"
7915-
integrity sha512-3DEun4VOeMvSczifM3F2cKQrDQ5Pj6WKhkOq6HD4QTnDUAq8MQRxy5TX6Sy1iY6WPBe4gQ3p5vTECjbIkglkkQ==
7908+
icss-utils@^4.0.0, icss-utils@^4.1.1:
7909+
version "4.1.1"
7910+
resolved "https://registry.yarnpkg.com/icss-utils/-/icss-utils-4.1.1.tgz#21170b53789ee27447c2f47dd683081403f9a467"
7911+
integrity sha512-4aFq7wvWyMHKgxsH8QQtGpvbASCf+eM3wPRLI6R+MgAnTCZ6STYsRvttLvRWK0Nfif5piF394St3HeJDaljGPA==
79167912
dependencies:
79177913
postcss "^7.0.14"
79187914

@@ -11851,14 +11847,15 @@ postcss-modules-extract-imports@^2.0.0:
1185111847
dependencies:
1185211848
postcss "^7.0.5"
1185311849

11854-
postcss-modules-local-by-default@^2.0.6:
11855-
version "2.0.6"
11856-
resolved "https://registry.yarnpkg.com/postcss-modules-local-by-default/-/postcss-modules-local-by-default-2.0.6.tgz#dd9953f6dd476b5fd1ef2d8830c8929760b56e63"
11857-
integrity sha512-oLUV5YNkeIBa0yQl7EYnxMgy4N6noxmiwZStaEJUSe2xPMcdNc8WmBQuQCx18H5psYbVxz8zoHk0RAAYZXP9gA==
11850+
postcss-modules-local-by-default@^3.0.2:
11851+
version "3.0.2"
11852+
resolved "https://registry.yarnpkg.com/postcss-modules-local-by-default/-/postcss-modules-local-by-default-3.0.2.tgz#e8a6561be914aaf3c052876377524ca90dbb7915"
11853+
integrity sha512-jM/V8eqM4oJ/22j0gx4jrp63GSvDH6v86OqyTHHUvk4/k1vceipZsaymiZ5PvocqZOl5SFHiFJqjs3la0wnfIQ==
1185811854
dependencies:
11859-
postcss "^7.0.6"
11860-
postcss-selector-parser "^6.0.0"
11861-
postcss-value-parser "^3.3.1"
11855+
icss-utils "^4.1.1"
11856+
postcss "^7.0.16"
11857+
postcss-selector-parser "^6.0.2"
11858+
postcss-value-parser "^4.0.0"
1186211859

1186311860
postcss-modules-scope@^2.1.0:
1186411861
version "2.1.0"
@@ -11868,12 +11865,12 @@ postcss-modules-scope@^2.1.0:
1186811865
postcss "^7.0.6"
1186911866
postcss-selector-parser "^6.0.0"
1187011867

11871-
postcss-modules-values@^2.0.0:
11872-
version "2.0.0"
11873-
resolved "https://registry.yarnpkg.com/postcss-modules-values/-/postcss-modules-values-2.0.0.tgz#479b46dc0c5ca3dc7fa5270851836b9ec7152f64"
11874-
integrity sha512-Ki7JZa7ff1N3EIMlPnGTZfUMe69FFwiQPnVSXC9mnn3jozCRBYIxiZd44yJOV2AmabOo4qFf8s0dC/+lweG7+w==
11868+
postcss-modules-values@^3.0.0:
11869+
version "3.0.0"
11870+
resolved "https://registry.yarnpkg.com/postcss-modules-values/-/postcss-modules-values-3.0.0.tgz#5b5000d6ebae29b4255301b4a3a54574423e7f10"
11871+
integrity sha512-1//E5jCBrZ9DmRX+zCtmQtRSV6PV42Ix7Bzj9GbwJceduuf7IqP8MgeTXuRDHOWj2m0VzZD5+roFWDuU8RQjcg==
1187511872
dependencies:
11876-
icss-replace-symbols "^1.1.0"
11873+
icss-utils "^4.0.0"
1187711874
postcss "^7.0.6"
1187811875

1187911876
postcss-nested@^4.1.1:
@@ -12021,7 +12018,7 @@ postcss-selector-parser@^5.0.0-rc.4:
1202112018
indexes-of "^1.0.1"
1202212019
uniq "^1.0.1"
1202312020

12024-
postcss-selector-parser@^6.0.0:
12021+
postcss-selector-parser@^6.0.0, postcss-selector-parser@^6.0.2:
1202512022
version "6.0.2"
1202612023
resolved "https://registry.yarnpkg.com/postcss-selector-parser/-/postcss-selector-parser-6.0.2.tgz#934cf799d016c83411859e09dcecade01286ec5c"
1202712024
integrity sha512-36P2QR59jDTOAiIkqEprfJDsoNrvwFei3eCqKd1Y0tUsBimsq39BLp7RD+JWny3WgB1zGhJX8XVePwm9k4wdBg==
@@ -12049,11 +12046,16 @@ postcss-unique-selectors@^4.0.1:
1204912046
postcss "^7.0.0"
1205012047
uniqs "^2.0.0"
1205112048

12052-
postcss-value-parser@^3.0.0, postcss-value-parser@^3.3.0, postcss-value-parser@^3.3.1:
12049+
postcss-value-parser@^3.0.0, postcss-value-parser@^3.3.1:
1205312050
version "3.3.1"
1205412051
resolved "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz#9ff822547e2893213cf1c30efa51ac5fd1ba8281"
1205512052
integrity sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ==
1205612053

12054+
postcss-value-parser@^4.0.0:
12055+
version "4.0.0"
12056+
resolved "https://registry.yarnpkg.com/postcss-value-parser/-/postcss-value-parser-4.0.0.tgz#99a983d365f7b2ad8d0f9b8c3094926eab4b936d"
12057+
integrity sha512-ESPktioptiSUchCKgggAkzdmkgzKfmp0EU8jXH+5kbIUB+unr0Y4CY9SRMvibuvYUBjNh1ACLbxqYNpdTQOteQ==
12058+
1205712059
postcss@^7.0.0, postcss@^7.0.1, postcss@^7.0.5:
1205812060
version "7.0.6"
1205912061
resolved "https://registry.npmjs.org/postcss/-/postcss-7.0.6.tgz#6dcaa1e999cdd4a255dcd7d4d9547f4ca010cdc2"
@@ -12072,6 +12074,15 @@ postcss@^7.0.14, postcss@^7.0.6:
1207212074
source-map "^0.6.1"
1207312075
supports-color "^6.1.0"
1207412076

12077+
postcss@^7.0.16, postcss@^7.0.17:
12078+
version "7.0.17"
12079+
resolved "https://registry.yarnpkg.com/postcss/-/postcss-7.0.17.tgz#4da1bdff5322d4a0acaab4d87f3e782436bad31f"
12080+
integrity sha512-546ZowA+KZ3OasvQZHsbuEpysvwTZNGJv9EfyCQdsIDltPSWHAeTQ5fQy/Npi2ZDtLI3zs7Ps/p6wThErhm9fQ==
12081+
dependencies:
12082+
chalk "^2.4.2"
12083+
source-map "^0.6.1"
12084+
supports-color "^6.1.0"
12085+
1207512086
posthtml-parser@^0.3.3:
1207612087
version "0.3.3"
1207712088
resolved "https://registry.npmjs.org/posthtml-parser/-/posthtml-parser-0.3.3.tgz#3fe986fca9f00c0f109d731ba590b192f26e776d"

0 commit comments

Comments
 (0)