@atlaspack/bundle-stats 2.12.1-dev.3365 → 2.12.1-dev.3398
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/lib/cli.js +5 -5
- package/package.json +8 -8
- package/src/cli.js +9 -9
package/lib/cli.js
CHANGED
@@ -44,7 +44,7 @@ async function run({
|
|
44
44
|
cacheDir,
|
45
45
|
outDir
|
46
46
|
}) {
|
47
|
-
// 1. load bundle graph and info via
|
47
|
+
// 1. load bundle graph and info via parcel~query
|
48
48
|
let {
|
49
49
|
bundleGraph,
|
50
50
|
bundleInfo
|
@@ -67,15 +67,15 @@ async function run({
|
|
67
67
|
let projectRoot = process.cwd();
|
68
68
|
|
69
69
|
// $FlowFixMe[unclear-type]
|
70
|
-
let
|
70
|
+
let parcelOptions = {
|
71
71
|
projectRoot
|
72
72
|
};
|
73
73
|
let bundlesByTarget = new (_utils().DefaultMap)(() => []);
|
74
74
|
for (let bundle of bundleGraph.getBundles()) {
|
75
|
-
bundlesByTarget.get(bundle.target.name).push(PackagedBundleClass.getWithInfo(bundle, bundleGraph,
|
75
|
+
bundlesByTarget.get(bundle.target.name).push(PackagedBundleClass.getWithInfo(bundle, bundleGraph, parcelOptions, bundleInfo.get(bundle.id)));
|
76
76
|
}
|
77
77
|
for (let [targetName, bundles] of bundlesByTarget) {
|
78
|
-
_fs().default.writeFileSync(_path().default.join(outDir, `${targetName}-stats.json`), JSON.stringify(getBundleStats(bundles,
|
78
|
+
_fs().default.writeFileSync(_path().default.join(outDir, `${targetName}-stats.json`), JSON.stringify(getBundleStats(bundles, parcelOptions), null, 2));
|
79
79
|
}
|
80
80
|
}
|
81
|
-
const command = exports.command = new (_commander().default.Command)().version(_package.version, '-V, --version').description('Generate a stats report for a
|
81
|
+
const command = exports.command = new (_commander().default.Command)().version(_package.version, '-V, --version').description('Generate a stats report for a Parcel build').option('-v, --verbose', 'Print verbose output').option('-c, --cache-dir <path>', 'Directory to the parcel cache', '.parcel-cache').option('-o, --out-dir <path>', 'Directory to write the stats to', 'parcel-bundle-reports').action(run);
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@atlaspack/bundle-stats",
|
3
|
-
"version": "2.12.1-dev.
|
3
|
+
"version": "2.12.1-dev.3398+81c73b3cd",
|
4
4
|
"license": "MIT",
|
5
5
|
"publishConfig": {
|
6
6
|
"access": "public"
|
@@ -20,19 +20,19 @@
|
|
20
20
|
},
|
21
21
|
"engines": {
|
22
22
|
"node": ">= 16.0.0",
|
23
|
-
"
|
23
|
+
"parcel": "^2.12.1-dev.3398+81c73b3cd"
|
24
24
|
},
|
25
25
|
"dependencies": {
|
26
|
-
"@atlaspack/core": "2.12.1-dev.
|
27
|
-
"@atlaspack/query": "2.12.1-dev.
|
28
|
-
"@atlaspack/reporter-bundle-stats": "2.12.1-dev.
|
29
|
-
"@atlaspack/utils": "2.12.1-dev.
|
26
|
+
"@atlaspack/core": "2.12.1-dev.3398+81c73b3cd",
|
27
|
+
"@atlaspack/query": "2.12.1-dev.3398+81c73b3cd",
|
28
|
+
"@atlaspack/reporter-bundle-stats": "2.12.1-dev.3398+81c73b3cd",
|
29
|
+
"@atlaspack/utils": "2.12.1-dev.3398+81c73b3cd",
|
30
30
|
"commander": "^7.0.0"
|
31
31
|
},
|
32
32
|
"devDependencies": {
|
33
33
|
"@atlaspack/babel-register": "2.12.0",
|
34
|
-
"@atlaspack/types": "2.12.1-dev.
|
34
|
+
"@atlaspack/types": "2.12.1-dev.3398+81c73b3cd",
|
35
35
|
"rimraf": "^5.0.5"
|
36
36
|
},
|
37
|
-
"gitHead": "
|
37
|
+
"gitHead": "81c73b3cdf93adf8b0013be9fed5422579bd5910"
|
38
38
|
}
|
package/src/cli.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
/* eslint-disable no-console, monorepo/no-internal-import */
|
2
2
|
// @flow strict-local
|
3
3
|
import type {PackagedBundle} from '@atlaspack/types';
|
4
|
-
import type {
|
4
|
+
import type {ParcelOptions} from '@atlaspack/core/src/types';
|
5
5
|
import type {commander$Command} from 'commander';
|
6
6
|
|
7
7
|
// $FlowFixMe[untyped-import]
|
@@ -19,7 +19,7 @@ const {
|
|
19
19
|
} = require('./deep-imports.js');
|
20
20
|
|
21
21
|
async function run({cacheDir, outDir}) {
|
22
|
-
// 1. load bundle graph and info via
|
22
|
+
// 1. load bundle graph and info via parcel~query
|
23
23
|
let {bundleGraph, bundleInfo} = await loadGraphs(cacheDir);
|
24
24
|
|
25
25
|
if (bundleGraph == null) {
|
@@ -40,7 +40,7 @@ async function run({cacheDir, outDir}) {
|
|
40
40
|
let projectRoot = process.cwd();
|
41
41
|
|
42
42
|
// $FlowFixMe[unclear-type]
|
43
|
-
let
|
43
|
+
let parcelOptions: ParcelOptions = ({projectRoot}: any);
|
44
44
|
|
45
45
|
let bundlesByTarget: DefaultMap<
|
46
46
|
string /* target name */,
|
@@ -53,7 +53,7 @@ async function run({cacheDir, outDir}) {
|
|
53
53
|
PackagedBundleClass.getWithInfo(
|
54
54
|
bundle,
|
55
55
|
bundleGraph,
|
56
|
-
|
56
|
+
parcelOptions,
|
57
57
|
bundleInfo.get(bundle.id),
|
58
58
|
),
|
59
59
|
);
|
@@ -62,23 +62,23 @@ async function run({cacheDir, outDir}) {
|
|
62
62
|
for (let [targetName, bundles] of bundlesByTarget) {
|
63
63
|
fs.writeFileSync(
|
64
64
|
path.join(outDir, `${targetName}-stats.json`),
|
65
|
-
JSON.stringify(getBundleStats(bundles,
|
65
|
+
JSON.stringify(getBundleStats(bundles, parcelOptions), null, 2),
|
66
66
|
);
|
67
67
|
}
|
68
68
|
}
|
69
69
|
|
70
70
|
export const command: commander$Command = new commander.Command()
|
71
71
|
.version(version, '-V, --version')
|
72
|
-
.description('Generate a stats report for a
|
72
|
+
.description('Generate a stats report for a Parcel build')
|
73
73
|
.option('-v, --verbose', 'Print verbose output')
|
74
74
|
.option(
|
75
75
|
'-c, --cache-dir <path>',
|
76
|
-
'Directory to the
|
77
|
-
'.
|
76
|
+
'Directory to the parcel cache',
|
77
|
+
'.parcel-cache',
|
78
78
|
)
|
79
79
|
.option(
|
80
80
|
'-o, --out-dir <path>',
|
81
81
|
'Directory to write the stats to',
|
82
|
-
'
|
82
|
+
'parcel-bundle-reports',
|
83
83
|
)
|
84
84
|
.action(run);
|