source-map-explorer 2.3.0 → 2.4.2
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/README.md +19 -7
- package/dist/api.d.ts +1 -7
- package/dist/api.js +49 -84
- package/dist/api.js.map +1 -0
- package/dist/app-error.d.ts +1 -1
- package/dist/app-error.js +13 -34
- package/dist/app-error.js.map +1 -0
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +58 -93
- package/dist/cli.js.map +1 -0
- package/dist/coverage.d.ts +1 -10
- package/dist/coverage.js +27 -125
- package/dist/coverage.js.map +1 -0
- package/dist/explore.d.ts +1 -4
- package/dist/explore.js +118 -150
- package/dist/explore.js.map +1 -0
- package/dist/helpers.d.ts +2 -16
- package/dist/helpers.js +35 -68
- package/dist/helpers.js.map +1 -0
- package/dist/html.d.ts +1 -7
- package/dist/html.js +68 -95
- package/dist/html.js.map +1 -0
- package/dist/index.d.ts +2 -90
- package/dist/index.js +9 -37
- package/dist/index.js.map +1 -0
- package/dist/output.d.ts +1 -1
- package/dist/output.js +21 -53
- package/dist/output.js.map +1 -0
- package/dist/types.d.ts +121 -0
- package/package.json +49 -50
package/dist/types.d.ts
ADDED
@@ -0,0 +1,121 @@
|
|
1
|
+
export interface FileData {
|
2
|
+
size: number;
|
3
|
+
coveredSize?: number;
|
4
|
+
}
|
5
|
+
|
6
|
+
export type FileDataMap = Record<string, FileData>;
|
7
|
+
|
8
|
+
export interface FileSizes {
|
9
|
+
files: FileDataMap;
|
10
|
+
mappedBytes: number;
|
11
|
+
unmappedBytes?: number;
|
12
|
+
eolBytes: number;
|
13
|
+
sourceMapCommentBytes: number;
|
14
|
+
totalBytes: number;
|
15
|
+
}
|
16
|
+
|
17
|
+
export type ErrorCode =
|
18
|
+
| 'Unknown'
|
19
|
+
| 'NoBundles'
|
20
|
+
| 'NoSourceMap'
|
21
|
+
| 'OneSourceSourceMap'
|
22
|
+
| 'UnmappedBytes'
|
23
|
+
| 'InvalidMappingLine'
|
24
|
+
| 'InvalidMappingColumn'
|
25
|
+
| 'CannotSaveFile'
|
26
|
+
| 'CannotCreateTempFile'
|
27
|
+
| 'CannotOpenTempFile'
|
28
|
+
| 'CannotOpenCoverageFile'
|
29
|
+
| 'NoCoverageMatches';
|
30
|
+
|
31
|
+
export type File = string | Buffer;
|
32
|
+
|
33
|
+
export type ReplaceMap = Record<string, string>;
|
34
|
+
|
35
|
+
type OutputFormat = 'json' | 'tsv' | 'html';
|
36
|
+
|
37
|
+
/** Represents single bundle */
|
38
|
+
export interface Bundle {
|
39
|
+
code: File;
|
40
|
+
map?: File;
|
41
|
+
coverageRanges?: ColumnsRange[][];
|
42
|
+
}
|
43
|
+
|
44
|
+
export interface ExploreOptions {
|
45
|
+
/** Exclude "unmapped" bytes from the output */
|
46
|
+
onlyMapped?: boolean;
|
47
|
+
/** Exclude source map comment size from output */
|
48
|
+
excludeSourceMapComment?: boolean;
|
49
|
+
/** Output result as a string */
|
50
|
+
output?: {
|
51
|
+
format: OutputFormat;
|
52
|
+
/** Filename to save output to */
|
53
|
+
filename?: string;
|
54
|
+
};
|
55
|
+
/** Disable removing prefix shared by all sources */
|
56
|
+
noRoot?: boolean;
|
57
|
+
/** Disable invalid mapping column/line checks. */
|
58
|
+
noBorderChecks?: boolean;
|
59
|
+
/** Replace "this" by "that" map */
|
60
|
+
replaceMap?: ReplaceMap;
|
61
|
+
coverage?: string;
|
62
|
+
/** Calculate gzip size. Setting it to `true` will also set `onlyMapped` to `true` */
|
63
|
+
gzip?: boolean;
|
64
|
+
/** Sort filenames */
|
65
|
+
sort?: boolean;
|
66
|
+
}
|
67
|
+
|
68
|
+
export interface ExploreResult {
|
69
|
+
bundles: ExploreBundleResult[];
|
70
|
+
/** Result as a string - either JSON, TSV or HTML */
|
71
|
+
output?: string;
|
72
|
+
errors: ExploreErrorResult[];
|
73
|
+
}
|
74
|
+
|
75
|
+
export interface ExploreBundleResult extends FileSizes {
|
76
|
+
bundleName: string;
|
77
|
+
}
|
78
|
+
|
79
|
+
export interface ExploreErrorResult {
|
80
|
+
bundleName: string;
|
81
|
+
code: string;
|
82
|
+
message: string;
|
83
|
+
error?: NodeJS.ErrnoException;
|
84
|
+
isWarning?: boolean;
|
85
|
+
}
|
86
|
+
|
87
|
+
export type BundlesAndFileTokens = (Bundle | string)[] | Bundle | string;
|
88
|
+
|
89
|
+
/** Represents inclusive range (e.g. [0,5] six columns) */
|
90
|
+
export interface ColumnsRange {
|
91
|
+
/** Fist column index */
|
92
|
+
start: number;
|
93
|
+
/** Last column index */
|
94
|
+
end: number;
|
95
|
+
}
|
96
|
+
|
97
|
+
export interface MappingRange extends ColumnsRange {
|
98
|
+
source: string;
|
99
|
+
}
|
100
|
+
|
101
|
+
/** Represents exclusive range (e.g. [0,5) - four columns) */
|
102
|
+
export interface Coverage {
|
103
|
+
url: string;
|
104
|
+
ranges: CoverageRange[];
|
105
|
+
/** File content as one line */
|
106
|
+
text: string;
|
107
|
+
}
|
108
|
+
|
109
|
+
export interface CoverageRange {
|
110
|
+
/** First column index */
|
111
|
+
start: number;
|
112
|
+
/** Column index next after last column index */
|
113
|
+
end: number;
|
114
|
+
}
|
115
|
+
|
116
|
+
// TODO: Remove when https://github.com/mozilla/source-map/pull/374 is published
|
117
|
+
declare module 'source-map' {
|
118
|
+
export interface MappingItem {
|
119
|
+
lastGeneratedColumn: number | null;
|
120
|
+
}
|
121
|
+
}
|
package/package.json
CHANGED
@@ -1,24 +1,31 @@
|
|
1
1
|
{
|
2
2
|
"name": "source-map-explorer",
|
3
|
-
"version": "2.
|
3
|
+
"version": "2.4.2",
|
4
4
|
"description": "Analyze and debug space usage through source maps",
|
5
5
|
"main": "dist/index.js",
|
6
6
|
"bin": {
|
7
7
|
"source-map-explorer": "dist/cli.js"
|
8
8
|
},
|
9
|
+
"engines": {
|
10
|
+
"node": ">=10"
|
11
|
+
},
|
9
12
|
"scripts": {
|
10
|
-
"
|
11
|
-
"
|
13
|
+
"build": "npm-run-all build:*",
|
14
|
+
"watch": "chokidar src/*.* -c \"npm run build\" --silent --initial --debounce=700",
|
15
|
+
"test:unit": "mocha --config .mocharc.unit.js",
|
16
|
+
"test:e2e": "mocha --config .mocharc.e2e.js",
|
17
|
+
"test:perf": "mocha --config .mocharc.perf.js",
|
18
|
+
"test": "npm-run-all test:unit test:e2e test:perf",
|
19
|
+
"coverage": "nyc --reporter=lcov --reporter=text npm run test:unit",
|
12
20
|
"test:update-snapshots": "cross-env SNAPSHOT_UPDATE=1 npm run test",
|
13
|
-
"
|
14
|
-
"lint": "eslint src/**/*.* tests/*.* --fix",
|
21
|
+
"test:generate-data": "ts-node tests/generate-data/index.ts",
|
15
22
|
"build:clean": "rimraf dist/**/*",
|
16
|
-
"build:compile": "
|
17
|
-
"build:copy": "copyfiles -u 1 src/vendor/*.* src/tree-viz.ejs dist",
|
23
|
+
"build:compile": "tsc --project tsconfig.build.json",
|
24
|
+
"build:copy": "copyfiles -u 1 src/vendor/*.* src/tree-viz.ejs src/types.d.ts dist",
|
18
25
|
"build:format": "prettier dist/*.js --write",
|
19
|
-
"
|
20
|
-
"
|
21
|
-
"
|
26
|
+
"pretest:e2e": "npm run build",
|
27
|
+
"coverage:ci": "nyc npm run test:unit && nyc report --reporter=text-lcov | coveralls",
|
28
|
+
"lint": "eslint src/**/*.* tests/*.* --fix",
|
22
29
|
"update-dependencies": "npx npm-check-updates -u && npm i",
|
23
30
|
"prepublishOnly": "npm run build"
|
24
31
|
},
|
@@ -37,21 +44,6 @@
|
|
37
44
|
"useRelativePath": true,
|
38
45
|
"extension": ".snap"
|
39
46
|
},
|
40
|
-
"nyc": {
|
41
|
-
"require": [
|
42
|
-
"@babel/register"
|
43
|
-
],
|
44
|
-
"extension": [
|
45
|
-
".ts"
|
46
|
-
],
|
47
|
-
"include": "src",
|
48
|
-
"exclude": [
|
49
|
-
"src/cli.ts",
|
50
|
-
"src/index.ts"
|
51
|
-
],
|
52
|
-
"sourceMap": false,
|
53
|
-
"instrument": false
|
54
|
-
},
|
55
47
|
"repository": {
|
56
48
|
"type": "git",
|
57
49
|
"url": "git+https://github.com/danvk/source-map-explorer.git"
|
@@ -62,6 +54,9 @@
|
|
62
54
|
"minification"
|
63
55
|
],
|
64
56
|
"author": "Dan Vanderkam (danvdk@gmail.com)",
|
57
|
+
"maintainers": [
|
58
|
+
"Nikolay Borzov <nikolay.n.borzov@gmail.com>"
|
59
|
+
],
|
65
60
|
"license": "Apache-2.0",
|
66
61
|
"bugs": {
|
67
62
|
"url": "https://github.com/danvk/source-map-explorer/issues"
|
@@ -76,62 +71,66 @@
|
|
76
71
|
"btoa": "^1.2.1",
|
77
72
|
"chalk": "^3.0.0",
|
78
73
|
"convert-source-map": "^1.7.0",
|
79
|
-
"ejs": "^3.0.
|
74
|
+
"ejs": "^3.0.2",
|
80
75
|
"escape-html": "^1.0.3",
|
81
76
|
"glob": "^7.1.6",
|
82
77
|
"gzip-size": "^5.1.1",
|
83
78
|
"lodash": "^4.17.15",
|
84
|
-
"open": "^7.0.
|
79
|
+
"open": "^7.0.3",
|
85
80
|
"source-map": "^0.7.3",
|
86
81
|
"temp": "^0.9.1",
|
87
|
-
"yargs": "^15.1
|
82
|
+
"yargs": "^15.3.1"
|
88
83
|
},
|
89
84
|
"devDependencies": {
|
90
|
-
"@babel/
|
91
|
-
"@babel/
|
92
|
-
"@
|
93
|
-
"@babel/plugin-proposal-object-rest-spread": "^7.8.3",
|
94
|
-
"@babel/preset-env": "^7.8.4",
|
95
|
-
"@babel/preset-typescript": "^7.8.3",
|
96
|
-
"@babel/register": "^7.8.3",
|
85
|
+
"@babel/core": "^7.9.0",
|
86
|
+
"@babel/preset-env": "^7.9.0",
|
87
|
+
"@istanbuljs/nyc-config-typescript": "^1.0.1",
|
97
88
|
"@smpx/snap-shot-it": "^6.6.1",
|
89
|
+
"@types/browserify": "^12.0.36",
|
98
90
|
"@types/btoa": "^1.2.3",
|
99
|
-
"@types/chai": "^4.2.
|
91
|
+
"@types/chai": "^4.2.11",
|
100
92
|
"@types/chai-as-promised": "^7.1.2",
|
101
93
|
"@types/concat-stream": "^1.6.0",
|
102
94
|
"@types/convert-source-map": "^1.5.1",
|
103
95
|
"@types/cross-spawn": "^6.0.1",
|
104
|
-
"@types/ejs": "^3.0.
|
96
|
+
"@types/ejs": "^3.0.1",
|
105
97
|
"@types/escape-html": "0.0.20",
|
106
98
|
"@types/glob": "^7.1.1",
|
107
99
|
"@types/lodash": "^4.14.149",
|
108
|
-
"@types/mocha": "^7.0.
|
100
|
+
"@types/mocha": "^7.0.2",
|
109
101
|
"@types/node": "^13.x",
|
110
|
-
"@types/rimraf": "^
|
102
|
+
"@types/rimraf": "^3.0.0",
|
111
103
|
"@types/temp": "^0.8.34",
|
112
|
-
"@types/yargs": "^15.0.
|
113
|
-
"@typescript-eslint/eslint-plugin": "^2.
|
114
|
-
"@typescript-eslint/parser": "^2.
|
115
|
-
"
|
104
|
+
"@types/yargs": "^15.0.4",
|
105
|
+
"@typescript-eslint/eslint-plugin": "^2.25.0",
|
106
|
+
"@typescript-eslint/parser": "^2.25.0",
|
107
|
+
"babelify": "^10.0.0",
|
108
|
+
"browserify": "^16.5.1",
|
116
109
|
"chai": "^4.2.0",
|
117
110
|
"chai-as-promised": "^7.1.1",
|
118
111
|
"chokidar-cli": "^2.1.0",
|
119
112
|
"concat-stream": "^2.0.0",
|
120
113
|
"copyfiles": "^2.2.0",
|
121
|
-
"coveralls": "^3.0.
|
122
|
-
"cross-env": "^7.0.
|
114
|
+
"coveralls": "^3.0.11",
|
115
|
+
"cross-env": "^7.0.2",
|
123
116
|
"cross-spawn": "^7.0.1",
|
124
117
|
"eslint": "^6.8.0",
|
125
|
-
"eslint-config-prettier": "^6.10.
|
118
|
+
"eslint-config-prettier": "^6.10.1",
|
126
119
|
"eslint-plugin-prettier": "^3.1.2",
|
120
|
+
"generate-source-map": "0.0.5",
|
127
121
|
"husky": "^4.2.3",
|
128
|
-
"lint-staged": "^10.0.
|
129
|
-
"mocha": "^7.
|
122
|
+
"lint-staged": "^10.0.10",
|
123
|
+
"mocha": "^7.1.1",
|
130
124
|
"npm-run-all": "^4.1.5",
|
131
125
|
"nyc": "^15.0.0",
|
132
|
-
"prettier": "^
|
126
|
+
"prettier": "^2.0.2",
|
133
127
|
"rewiremock": "^3.13.9",
|
134
128
|
"rimraf": "^3.0.2",
|
135
|
-
"
|
129
|
+
"source-map-support": "^0.5.16",
|
130
|
+
"terser": "^4.6.7",
|
131
|
+
"terser-webpack-plugin": "^2.3.5",
|
132
|
+
"ts-node": "^8.8.1",
|
133
|
+
"typescript": "^3.8.3",
|
134
|
+
"webpack": "^4.42.1"
|
136
135
|
}
|
137
136
|
}
|