@dcaldeira/tooling 0.2.0 → 0.2.1

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/checks/bundle.mjs CHANGED
@@ -101,10 +101,12 @@ export function analyseBundle(root, budget) {
101
101
  if (error.code !== 'ENOENT') throw error;
102
102
  }
103
103
  const size = gzip(file) / 1024;
104
- const cap = vendor ? vendor[2] : budget.chunkKB;
104
+ // A file with no source map, such as a pre-built worker, gets its allowance by path.
105
+ const allowed = vendor ?? (budget.files ?? []).find(([part]) => file.includes(part));
106
+ const cap = allowed ? allowed[2] : budget.chunkKB;
105
107
  if (size > cap)
106
108
  errors.push(
107
- `${file} (${vendor ? vendor[1] : 'route chunk'}) ${size.toFixed(1)} KB > ${cap} KB`,
109
+ `${file} (${allowed ? allowed[1] : 'route chunk'}) ${size.toFixed(1)} KB > ${cap} KB`,
108
110
  );
109
111
  }
110
112
  return { initialKB, initial: [...initial], chunks: chunks.length, errors };
@@ -403,6 +403,28 @@
403
403
  }
404
404
  ]
405
405
  }
406
+ },
407
+ "files": {
408
+ "type": "array",
409
+ "items": {
410
+ "type": "array",
411
+ "minItems": 3,
412
+ "maxItems": 3,
413
+ "prefixItems": [
414
+ {
415
+ "type": "string",
416
+ "minLength": 1
417
+ },
418
+ {
419
+ "type": "string",
420
+ "minLength": 1
421
+ },
422
+ {
423
+ "type": "number",
424
+ "exclusiveMinimum": 0
425
+ }
426
+ ]
427
+ }
406
428
  }
407
429
  }
408
430
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcaldeira/tooling",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Shared checks and change detection for local development and GitHub Actions",
5
5
  "type": "module",
6
6
  "license": "MIT",