@massimo-cassandro/minimo 1.19.5 → 1.19.7

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.
@@ -163,7 +163,7 @@ Alias references (`{color.brand.primary}`) are preserved in the output so Penpot
163
163
  Scans all `.css` files in `dirToCheck` (recursively) and reports:
164
164
 
165
165
  - **unresolved properties** — `var(--...)` references that are not defined in the generated token CSS file or in any `extraCustomPropsFiles`
166
- - **unused properties** — custom properties defined in the generated token CSS file (or an `extraCustomPropsFiles` entry) but never referenced via `var()` in any scanned CSS file. Only reported if `checkUnused: true` is set in the config, since it re-runs the Style Dictionary transform pipeline over the token sources to resolve, when possible, the `.mjs` source file for each unused property.
166
+ - **unused properties** — custom properties defined in the generated token CSS file (or an `extraCustomPropsFiles` entry) but never referenced via `var()` in any scanned CSS file. Only reported if `checkUnused: true` is set in the config, since it re-runs the Style Dictionary transform pipeline over the token sources to resolve, when possible, the `.mjs` source file for each unused property. When `ignoreUnusedInNodeModules` is true (default), properties sourced from a token file under `node_modules` (e.g. a third-party token package) are never reported as unused.
167
167
 
168
168
  Results are written to `unresolved-unused-props.md` in the same directory as the config file.
169
169
 
@@ -96,6 +96,12 @@ const config = {
96
96
  // .mjs source file for each unused property. Default: false.
97
97
  checkUnused: true,
98
98
 
99
+ // When checkUnused is true: if true (default), custom properties sourced
100
+ // from a token file under node_modules (e.g. a third-party token package)
101
+ // are never reported as unused — the consuming project isn't expected to
102
+ // prune those.
103
+ ignoreUnusedInNodeModules: true,
104
+
99
105
  // Additional CSS files that define custom properties used in the project
100
106
  // but not generated by build-tokens (e.g. third-party libraries)
101
107
  extraCustomPropsFiles: [
@@ -143,19 +143,13 @@ async function run() {
143
143
  // just to resolve source files, which adds a noticeable cost.
144
144
  const checkUnused = config.checkUnused === true;
145
145
 
146
- // ---------------------------------------------------------------------------
147
- // 5. Build the list of unused custom properties (defined but never
148
- // referenced via var() in any scanned CSS file) — the opposite check
149
- // of section 4.
150
- // ---------------------------------------------------------------------------
151
- const unused_props = checkUnused
152
- ? defined_props
153
- .filter(item => !used_props_set.has(item.prop))
154
- .sort((a, b) => a.prop.localeCompare(b.prop))
155
- : [];
146
+ // If true (default), properties sourced from a token file under
147
+ // node_modules (e.g. a third-party token package) are never reported as
148
+ // unused — the consuming project isn't expected to prune those.
149
+ const ignoreUnusedInNodeModules = config.ignoreUnusedInNodeModules !== false;
156
150
 
157
151
  // ---------------------------------------------------------------------------
158
- // 6. Best-effort: resolve the .mjs token source file for each unused
152
+ // 5. Best-effort: resolve the .mjs token source file for each defined
159
153
  // property, by running the same transform pipeline used to generate the
160
154
  // CSS (see build-tokens-src/formats/css.mjs) over the token sources
161
155
  // declared in config.source. Properties that only exist in the generated
@@ -184,6 +178,24 @@ async function run() {
184
178
  }
185
179
  }
186
180
 
181
+ // ---------------------------------------------------------------------------
182
+ // 6. Build the list of unused custom properties (defined but never
183
+ // referenced via var() in any scanned CSS file) — the opposite check
184
+ // of section 4. Properties sourced from node_modules are skipped when
185
+ // ignoreUnusedInNodeModules is true (default).
186
+ // ---------------------------------------------------------------------------
187
+ const unused_props = checkUnused
188
+ ? defined_props
189
+ .filter(item => !used_props_set.has(item.prop))
190
+ .filter(item => {
191
+ if (!ignoreUnusedInNodeModules) return true;
192
+ const sourceFilePath = sourceFileByProp.get(item.prop);
193
+ if (!sourceFilePath) return true;
194
+ return !/(^|[\\/])node_modules([\\/]|$)/.test(sourceFilePath);
195
+ })
196
+ .sort((a, b) => a.prop.localeCompare(b.prop))
197
+ : [];
198
+
187
199
  // ---------------------------------------------------------------------------
188
200
  // 7. Write the report
189
201
  // ---------------------------------------------------------------------------
@@ -27,7 +27,7 @@
27
27
  "launchChrome": "open -n -a 'Google Chrome' --args --profile-directory='Profile 3'",
28
28
  "python server": "python3 -m http.server 8000 # --directory __dirname__ # 8000 = default port",
29
29
  "php server": "php -S localhost:8000 # -t root_dir/",
30
- "symfony local server": "symfony serve -d",
30
+ "symfony server": "symfony serve -d --port=8100 --listen-ip=0.0.0.0 # symfony server:stop # http://192.168.1.135:8100",
31
31
  "node server": "node serve # richiede ‘npm i serve’",
32
32
  "build tokens": "npx buildTokens --config ./path/to/tokens-config.mjs",
33
33
  "check unresolved props": "npx checkUnresolvedProps --config ./path/to/tokens-config.mjs"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@massimo-cassandro/minimo",
3
- "version": "1.19.5",
3
+ "version": "1.19.7",
4
4
  "description": "Light css framework & utilities",
5
5
  "type": "module",
6
6
  "main": "./index.js",
@@ -1,10 +1,10 @@
1
1
  {#-
2
2
  https://symfony.com/doc/current/controller/error_pages.html#testing-error-pages-during-development
3
3
 
4
- test errori: https://project.local:8890/_error/<error code>
4
+ test: https://project.local:8890/_error/500 (or 403, 404... )
5
5
  -#}
6
6
  <!DOCTYPE html>
7
- <html lang="it" data-err-code="{{ status_code }}" data-err-text="{{ status_text}}">
7
+ <html lang="it" data-err-code="{{ status_code }}" data-err-text="{{ status_text }}">
8
8
  <head>
9
9
  <meta charset="utf-8">
10
10
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
@@ -33,6 +33,4 @@ unsplashPage({
33
33
  text : `(${errCode} ${errText})`,
34
34
  backLink : errCode !== '503'? 'Torna alla <a href="/">Home</a>' : '',
35
35
  // hidePhotoLink : true,
36
- // cssModules : false,
37
- // cssModulesObj : null
38
36
  });
@@ -36,7 +36,6 @@ export async function unsplashPage(settings) {
36
36
  text : null,
37
37
  backLink : null,
38
38
  hidePhotoLink : true,
39
- cssModulesObj : null
40
39
  },
41
40
  required_settings = ['targetElement', 'unsplashDataUrl', 'utmSource', 'title'];
42
41