@atlaspack/bundle-stats 2.14.5-canary.49 → 2.14.5-canary.491
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/CHANGELOG.md +588 -0
- package/dist/cli.js +47 -0
- package/dist/deep-imports.js +17 -0
- package/lib/bin.js +3 -0
- package/lib/cli.js +7 -4
- package/lib/deep-imports.js +6 -4
- package/lib/types/cli.d.ts +2 -0
- package/lib/types/deep-imports.d.ts +1 -0
- package/package.json +16 -15
- package/src/bin.js +2 -1
- package/src/{cli.js → cli.ts} +5 -6
- package/src/deep-imports.ts +33 -0
- package/tsconfig.json +27 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/src/deep-imports.js +0 -30
package/lib/cli.js
CHANGED
|
@@ -33,13 +33,18 @@ function _utils() {
|
|
|
33
33
|
};
|
|
34
34
|
return data;
|
|
35
35
|
}
|
|
36
|
-
function _interopRequireDefault(
|
|
37
|
-
/* eslint-disable no-console, monorepo/no-internal-import */
|
|
36
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
37
|
+
/* eslint-disable no-console, monorepo/no-internal-import */
|
|
38
|
+
|
|
39
|
+
// @ts-expect-error invalid export
|
|
40
|
+
|
|
38
41
|
const {
|
|
39
42
|
loadGraphs,
|
|
40
43
|
getBundleStats,
|
|
41
44
|
PackagedBundleClass
|
|
42
45
|
} = require('./deep-imports.js');
|
|
46
|
+
|
|
47
|
+
// @ts-expect-error no types
|
|
43
48
|
async function run({
|
|
44
49
|
cacheDir,
|
|
45
50
|
outDir
|
|
@@ -65,8 +70,6 @@ async function run({
|
|
|
65
70
|
recursive: true
|
|
66
71
|
});
|
|
67
72
|
let projectRoot = process.cwd();
|
|
68
|
-
|
|
69
|
-
// $FlowFixMe[unclear-type]
|
|
70
73
|
let parcelOptions = {
|
|
71
74
|
projectRoot
|
|
72
75
|
};
|
package/lib/deep-imports.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
/* eslint-disable monorepo/no-internal-import */
|
|
4
|
-
|
|
4
|
+
|
|
5
|
+
module.exports = process.env.ATLASPACK_BUILD_ENV === 'production' || process.env.ATLASPACK_REGISTER_USE_SRC !== 'true' ? {
|
|
5
6
|
// Split up require specifier to outsmart packages/dev/babel-register/babel-plugin-module-translate.js
|
|
6
|
-
// $FlowFixMe(unsupported-syntax)
|
|
7
7
|
loadGraphs: require('@atlaspack/query' + '/lib/index.js').loadGraphs,
|
|
8
|
-
// $FlowFixMe(unsupported-syntax)
|
|
9
8
|
getBundleStats: require('@atlaspack/reporter-bundle-stats' + '/lib/BundleStatsReporter.js').getBundleStats,
|
|
10
|
-
// $FlowFixMe(unsupported-syntax)
|
|
11
9
|
PackagedBundleClass: require('@atlaspack/core' + '/lib/public/Bundle.js').PackagedBundle
|
|
10
|
+
} : {
|
|
11
|
+
loadGraphs: require('@atlaspack/query/src/index.js').loadGraphs,
|
|
12
|
+
getBundleStats: require('@atlaspack/reporter-bundle-stats/src/BundleStatsReporter.js').getBundleStats,
|
|
13
|
+
PackagedBundleClass: require('@atlaspack/core/src/public/Bundle.js').PackagedBundle
|
|
12
14
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaspack/bundle-stats",
|
|
3
|
-
"version": "2.14.5-canary.
|
|
3
|
+
"version": "2.14.5-canary.491+40f001272",
|
|
4
4
|
"license": "(MIT OR Apache-2.0)",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -9,30 +9,31 @@
|
|
|
9
9
|
"type": "git",
|
|
10
10
|
"url": "https://github.com/atlassian-labs/atlaspack.git"
|
|
11
11
|
},
|
|
12
|
-
"main": "lib/cli.js",
|
|
13
|
-
"source": "src/cli.
|
|
12
|
+
"main": "./lib/cli.js",
|
|
13
|
+
"source": "./src/cli.ts",
|
|
14
|
+
"types": "./lib/types/cli.d.ts",
|
|
14
15
|
"bin": {
|
|
15
16
|
"atlaspack-bundle-stats": "bin/bundle-stats.js"
|
|
16
17
|
},
|
|
17
18
|
"scripts": {
|
|
18
|
-
"
|
|
19
|
-
"
|
|
19
|
+
"dev:prepare": "rimraf ./lib/ && mkdir -p lib && cp ./bin/dev-bin.js ./lib/bin.js",
|
|
20
|
+
"build:lib": "gulp build --gulpfile ../../../gulpfile.js --cwd ."
|
|
20
21
|
},
|
|
21
22
|
"engines": {
|
|
22
23
|
"node": ">= 16.0.0"
|
|
23
24
|
},
|
|
24
25
|
"dependencies": {
|
|
25
|
-
"@atlaspack/core": "2.16.2-canary.
|
|
26
|
-
"@atlaspack/query": "2.14.5-canary.
|
|
27
|
-
"@atlaspack/reporter-bundle-stats": "2.14.5-canary.
|
|
28
|
-
"@atlaspack/utils": "2.14.5-canary.
|
|
29
|
-
"commander": "^
|
|
26
|
+
"@atlaspack/core": "2.16.2-canary.491+40f001272",
|
|
27
|
+
"@atlaspack/query": "2.14.5-canary.491+40f001272",
|
|
28
|
+
"@atlaspack/reporter-bundle-stats": "2.14.5-canary.491+40f001272",
|
|
29
|
+
"@atlaspack/utils": "2.14.5-canary.491+40f001272",
|
|
30
|
+
"commander": "^8.3.0"
|
|
30
31
|
},
|
|
31
32
|
"devDependencies": {
|
|
32
|
-
"@atlaspack/babel-register": "2.14.
|
|
33
|
-
"@atlaspack/types": "2.14.5-canary.
|
|
34
|
-
"rimraf": "^
|
|
33
|
+
"@atlaspack/babel-register": "2.14.5",
|
|
34
|
+
"@atlaspack/types": "2.14.5-canary.491+40f001272",
|
|
35
|
+
"rimraf": "^3.0.2"
|
|
35
36
|
},
|
|
36
37
|
"type": "commonjs",
|
|
37
|
-
"gitHead": "
|
|
38
|
-
}
|
|
38
|
+
"gitHead": "40f0012726d0b82cc825d880d6752d800f04f3b4"
|
|
39
|
+
}
|
package/src/bin.js
CHANGED
package/src/{cli.js → cli.ts}
RENAMED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/* eslint-disable no-console, monorepo/no-internal-import */
|
|
2
|
-
// @flow strict-local
|
|
3
2
|
import type {PackagedBundle} from '@atlaspack/types';
|
|
4
3
|
import type {ParcelOptions} from '@atlaspack/core/src/types';
|
|
4
|
+
// @ts-expect-error invalid export
|
|
5
5
|
import type {commander$Command} from 'commander';
|
|
6
6
|
|
|
7
|
-
// $FlowFixMe[untyped-import]
|
|
8
7
|
import {version} from '../package.json';
|
|
9
8
|
|
|
10
9
|
import commander from 'commander';
|
|
@@ -18,6 +17,7 @@ const {
|
|
|
18
17
|
PackagedBundleClass,
|
|
19
18
|
} = require('./deep-imports.js');
|
|
20
19
|
|
|
20
|
+
// @ts-expect-error no types
|
|
21
21
|
async function run({cacheDir, outDir}) {
|
|
22
22
|
// 1. load bundle graph and info via parcel~query
|
|
23
23
|
let {bundleGraph, bundleInfo} = await loadGraphs(cacheDir);
|
|
@@ -39,12 +39,11 @@ async function run({cacheDir, outDir}) {
|
|
|
39
39
|
|
|
40
40
|
let projectRoot = process.cwd();
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
let parcelOptions: ParcelOptions = ({projectRoot}: any);
|
|
42
|
+
let parcelOptions: ParcelOptions = {projectRoot} as any;
|
|
44
43
|
|
|
45
44
|
let bundlesByTarget: DefaultMap<
|
|
46
45
|
string /* target name */,
|
|
47
|
-
Array<PackagedBundle
|
|
46
|
+
Array<PackagedBundle>
|
|
48
47
|
> = new DefaultMap(() => []);
|
|
49
48
|
for (let bundle of bundleGraph.getBundles()) {
|
|
50
49
|
bundlesByTarget
|
|
@@ -67,7 +66,7 @@ async function run({cacheDir, outDir}) {
|
|
|
67
66
|
}
|
|
68
67
|
}
|
|
69
68
|
|
|
70
|
-
export const command: commander
|
|
69
|
+
export const command: commander.Command = new commander.Command()
|
|
71
70
|
.version(version, '-V, --version')
|
|
72
71
|
.description('Generate a stats report for a Parcel build')
|
|
73
72
|
.option('-v, --verbose', 'Print verbose output')
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/* eslint-disable monorepo/no-internal-import */
|
|
2
|
+
import {loadGraphs} from '@atlaspack/query/src/index';
|
|
3
|
+
import {getBundleStats} from '@atlaspack/reporter-bundle-stats/src/BundleStatsReporter';
|
|
4
|
+
import {PackagedBundle as PackagedBundleClass} from '@atlaspack/core/src/public/Bundle';
|
|
5
|
+
|
|
6
|
+
module.exports = (
|
|
7
|
+
process.env.ATLASPACK_BUILD_ENV === 'production' ||
|
|
8
|
+
process.env.ATLASPACK_REGISTER_USE_SRC !== 'true'
|
|
9
|
+
? {
|
|
10
|
+
// Split up require specifier to outsmart packages/dev/babel-register/babel-plugin-module-translate.js
|
|
11
|
+
loadGraphs: require('@atlaspack/query' + '/lib/index.js').loadGraphs,
|
|
12
|
+
getBundleStats: require(
|
|
13
|
+
'@atlaspack/reporter-bundle-stats' + '/lib/BundleStatsReporter.js',
|
|
14
|
+
).getBundleStats,
|
|
15
|
+
PackagedBundleClass: require(
|
|
16
|
+
'@atlaspack/core' + '/lib/public/Bundle.js',
|
|
17
|
+
).PackagedBundle,
|
|
18
|
+
}
|
|
19
|
+
: {
|
|
20
|
+
loadGraphs: require('@atlaspack/query/src/index.js').loadGraphs,
|
|
21
|
+
getBundleStats:
|
|
22
|
+
require('@atlaspack/reporter-bundle-stats/src/BundleStatsReporter.js')
|
|
23
|
+
.getBundleStats,
|
|
24
|
+
PackagedBundleClass: require('@atlaspack/core/src/public/Bundle.js')
|
|
25
|
+
.PackagedBundle,
|
|
26
|
+
}
|
|
27
|
+
) as {
|
|
28
|
+
// @ts-expect-error TS2749
|
|
29
|
+
loadGraphs: loadGraphs;
|
|
30
|
+
// @ts-expect-error TS2749
|
|
31
|
+
getBundleStats: getBundleStats;
|
|
32
|
+
PackagedBundleClass: PackagedBundleClass;
|
|
33
|
+
};
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../../tsconfig.base.json",
|
|
3
|
+
"include": ["./src/", "./package.json"],
|
|
4
|
+
"compilerOptions": {
|
|
5
|
+
"composite": true
|
|
6
|
+
},
|
|
7
|
+
"references": [
|
|
8
|
+
{
|
|
9
|
+
"path": "../../core/core/tsconfig.json"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"path": "../../core/types/tsconfig.json"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"path": "../../core/utils/tsconfig.json"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"path": "../../reporters/bundle-stats/tsconfig.json"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"path": "../babel-register/tsconfig.json"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"path": "../query/tsconfig.json"
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
}
|