@size-limit/esbuild-why 8.2.6 → 10.0.0

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/index.js CHANGED
@@ -1,28 +1,28 @@
1
- let { visualizer } = require('esbuild-visualizer')
2
- let { join } = require('path')
3
- let { writeFileSync } = require('fs')
4
- let open = require('open')
1
+ import { visualizer } from 'esbuild-visualizer'
2
+ import { writeFileSync } from 'node:fs'
3
+ import { join } from 'node:path'
4
+ import open from 'open'
5
5
 
6
- let { getReportName } = require('./report')
6
+ import { getReportName } from './report'
7
7
 
8
- let self = {
9
- async finally(config, check) {
10
- let {esbuildVisualizerFile} = check
8
+ export default [
9
+ {
10
+ async finally(config, check) {
11
+ let { esbuildVisualizerFile } = check
11
12
 
12
- if (esbuildVisualizerFile) {
13
- await open(esbuildVisualizerFile)
14
- }
15
- },
13
+ if (esbuildVisualizerFile) {
14
+ await open(esbuildVisualizerFile)
15
+ }
16
+ },
16
17
 
17
- name: '@size-limit/esbuild-why',
18
- async step81(config, check) {
19
- if (config.why && check.esbuildMetafile) {
20
- let result = await visualizer(check.esbuildMetafile)
21
- let file = join(config.saveBundle ?? '', getReportName(config, check))
22
- check.esbuildVisualizerFile = file;
23
- writeFileSync(file, result)
18
+ name: '@size-limit/esbuild-why',
19
+ async step81(config, check) {
20
+ if (config.why && check.esbuildMetafile) {
21
+ let result = await visualizer(check.esbuildMetafile)
22
+ let file = join(config.saveBundle ?? '', getReportName(config, check))
23
+ check.esbuildVisualizerFile = file
24
+ writeFileSync(file, result)
25
+ }
24
26
  }
25
27
  }
26
- }
27
-
28
- module.exports = [self]
28
+ ]
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@size-limit/esbuild-why",
3
- "version": "8.2.6",
3
+ "version": "10.0.0",
4
4
  "description": "esbuild plugin for Size Limit",
5
+ "type": "module",
5
6
  "keywords": [
6
7
  "size-limit",
7
8
  "plugin",
@@ -14,13 +15,13 @@
14
15
  "license": "MIT",
15
16
  "repository": "ai/size-limit",
16
17
  "engines": {
17
- "node": "^14.0.0 || ^16.0.0 || >=18.0.0"
18
+ "node": "^18.0.0 || >=20.0.0"
18
19
  },
19
20
  "peerDependencies": {
20
- "size-limit": "8.2.6"
21
+ "size-limit": "10.0.0"
21
22
  },
22
23
  "dependencies": {
23
- "esbuild-visualizer": "^0.4.0",
24
- "open": "^8.4.2"
24
+ "esbuild-visualizer": "^0.4.1",
25
+ "open": "^9.1.0"
25
26
  }
26
27
  }
package/report.js CHANGED
@@ -1,10 +1,8 @@
1
- let { isValidFilename } = require('./valid-filename')
1
+ import { isValidFilename } from './valid-filename'
2
2
 
3
- module.exports = {
4
- getReportName(config, check) {
5
- if (config.checks.length === 1) return `esbuild-why.html`
6
- if (isValidFilename(check.name)) return `esbuild-why-${check.name}.html`
7
- let index = config.checks.findIndex(c => c.name === check.name)
8
- return `esbuild-why-${index + 1}.html`
9
- }
3
+ export function getReportName(config, check) {
4
+ if (config.checks.length === 1) return `esbuild-why.html`
5
+ if (isValidFilename(check.name)) return `esbuild-why-${check.name}.html`
6
+ let index = config.checks.findIndex(c => c.name === check.name)
7
+ return `esbuild-why-${index + 1}.html`
10
8
  }
package/valid-filename.js CHANGED
@@ -1,11 +1,9 @@
1
- module.exports = {
2
- isValidFilename(string) {
3
- if (!string || string.length > 255 || string === '.' || string === '..') {
4
- return false
5
- }
6
- return (
7
- !/[<>:"/\\|?*\u0000-\u001F]/g.test(string) &&
8
- !/^(con|prn|aux|nul|com\d|lpt\d)$/i.test(string)
9
- )
1
+ export function isValidFilename(string) {
2
+ if (!string || string.length > 255 || string === '.' || string === '..') {
3
+ return false
10
4
  }
5
+ return (
6
+ !/[<>:"/\\|?*\u0000-\u001F]/g.test(string) &&
7
+ !/^(con|prn|aux|nul|com\d|lpt\d)$/i.test(string)
8
+ )
11
9
  }