@transferwise/neptune-css 0.0.0-experimental-dd2ee34 → 0.0.0-experimental-d1de8f6
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,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@transferwise/neptune-css",
|
|
3
3
|
"description": "Neptune CSS library",
|
|
4
|
-
"version": "0.0.0-experimental-
|
|
4
|
+
"version": "0.0.0-experimental-d1de8f6",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -28,12 +28,13 @@
|
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"modern-normalize": "^2.0.0",
|
|
30
30
|
"yargs": "^17.1.1",
|
|
31
|
-
"@transferwise/less-config": "0.0.0-experimental-
|
|
31
|
+
"@transferwise/less-config": "0.0.0-experimental-d1de8f6"
|
|
32
32
|
},
|
|
33
33
|
"publishConfig": {
|
|
34
34
|
"access": "public"
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
37
|
+
"analyze:css-selectors": "node ./scripts/analyze-css-selectors.js",
|
|
37
38
|
"build": "npm-run-all build:*",
|
|
38
39
|
"build:clean": "rm -rf dist",
|
|
39
40
|
"build:copy-assets": "npm-run-all --parallel copy:*",
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/* eslint-disable no-console */
|
|
2
|
+
|
|
3
|
+
const fs = require('node:fs');
|
|
4
|
+
const path = require('node:path');
|
|
5
|
+
|
|
6
|
+
const postcss = require('postcss');
|
|
7
|
+
|
|
8
|
+
const root = postcss.parse(fs.readFileSync(path.join(__dirname, '../dist/css/neptune.css')));
|
|
9
|
+
|
|
10
|
+
/** @type {Set<string>} */
|
|
11
|
+
const selectors = new Set();
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @param {postcss.ChildNode} node
|
|
15
|
+
*/
|
|
16
|
+
function visitNode(node) {
|
|
17
|
+
switch (node.type) {
|
|
18
|
+
case 'rule': {
|
|
19
|
+
for (const selector of node.selectors) {
|
|
20
|
+
selectors.add(selector);
|
|
21
|
+
}
|
|
22
|
+
break;
|
|
23
|
+
}
|
|
24
|
+
case 'atrule': {
|
|
25
|
+
for (const childNode of node.nodes) {
|
|
26
|
+
visitNode(childNode);
|
|
27
|
+
}
|
|
28
|
+
break;
|
|
29
|
+
}
|
|
30
|
+
default:
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
for (const node of root.nodes) {
|
|
35
|
+
visitNode(node);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const sortedClassNameSelectors = [...selectors].filter((selector) => selector.includes('.')).sort();
|
|
39
|
+
console.log(JSON.stringify(sortedClassNameSelectors, null, 2));
|