@corellium/corellium-cli 1.2.0 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- package/.gitlab-ci.yml +46 -1
- package/ci/gitlab-build.sh +1 -1
- package/coverage/cobertura-coverage.xml +9 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +87 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +101 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +196 -0
- package/coverage/lcov.info +0 -0
- package/index.js +2 -0
- package/node_modules/@babel/cli/node_modules/commander/package.json +22 -57
- package/node_modules/@babel/cli/node_modules/make-dir/package.json +57 -92
- package/node_modules/@babel/cli/node_modules/pify/package.json +49 -84
- package/node_modules/@babel/cli/node_modules/semver/package.json +15 -50
- package/node_modules/@babel/cli/node_modules/slash/package.json +32 -67
- package/node_modules/@babel/cli/package.json +33 -69
- package/node_modules/@corellium/client-api/package.json +10 -39
- package/node_modules/@jridgewell/resolve-uri/package.json +35 -74
- package/node_modules/@jridgewell/sourcemap-codec/package.json +38 -73
- package/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs +91 -57
- package/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs.map +1 -1
- package/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.umd.js +90 -56
- package/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.umd.js.map +1 -1
- package/node_modules/@jridgewell/trace-mapping/dist/types/trace-mapping.d.ts +5 -5
- package/node_modules/@jridgewell/trace-mapping/dist/types/types.d.ts +12 -5
- package/node_modules/@jridgewell/trace-mapping/package.json +34 -71
- package/node_modules/@nicolo-ribaudo/chokidar-2/package.json +17 -54
- package/node_modules/ansi-regex/package.json +53 -88
- package/node_modules/ansi-styles/package.json +54 -94
- package/node_modules/anymatch/package.json +23 -55
- package/node_modules/asynckit/package.json +40 -73
- package/node_modules/axios/package.json +41 -71
- package/node_modules/balanced-match/package.json +17 -48
- package/node_modules/binary-extensions/package.json +36 -72
- package/node_modules/brace-expansion/package.json +18 -49
- package/node_modules/braces/package.json +25 -75
- package/node_modules/call-bind/package.json +78 -124
- package/node_modules/chokidar/package.json +35 -73
- package/node_modules/cliui/package.json +48 -86
- package/node_modules/color-convert/package.json +20 -58
- package/node_modules/color-name/package.json +28 -60
- package/node_modules/combined-stream/package.json +14 -51
- package/node_modules/component-emitter/package.json +12 -44
- package/node_modules/concat-map/package.json +40 -88
- package/node_modules/convert-source-map/package.json +23 -54
- package/node_modules/cookiejar/package.json +11 -43
- package/node_modules/debug/package.json +32 -86
- package/node_modules/delayed-stream/package.json +14 -52
- package/node_modules/dotenv/package.json +32 -63
- package/node_modules/emoji-regex/package.json +27 -57
- package/node_modules/escalade/package.json +23 -58
- package/node_modules/fast-safe-stringify/package.json +28 -72
- package/node_modules/fill-range/package.json +23 -71
- package/node_modules/follow-redirects/package.json +37 -76
- package/node_modules/form-data/package.json +37 -73
- package/node_modules/formidable/package.json +17 -51
- package/node_modules/fs-readdir-recursive/package.json +15 -49
- package/node_modules/fs.realpath/package.json +16 -52
- package/node_modules/function-bind/package.json +23 -60
- package/node_modules/get-caller-file/package.json +22 -52
- package/node_modules/get-intrinsic/package.json +86 -123
- package/node_modules/glob/package.json +29 -67
- package/node_modules/glob-parent/package.json +22 -69
- package/node_modules/has/package.json +21 -54
- package/node_modules/has-symbols/package.json +99 -132
- package/node_modules/inflight/package.json +15 -47
- package/node_modules/inherits/package.json +12 -53
- package/node_modules/is-binary-path/package.json +38 -74
- package/node_modules/is-extglob/package.json +17 -51
- package/node_modules/is-fullwidth-code-point/package.json +40 -78
- package/node_modules/is-glob/package.json +21 -67
- package/node_modules/is-number/package.json +21 -64
- package/node_modules/lru-cache/package.json +22 -60
- package/node_modules/methods/package.json +17 -63
- package/node_modules/mime/package.json +15 -47
- package/node_modules/mime-db/package.json +20 -66
- package/node_modules/mime-types/package.json +15 -63
- package/node_modules/minimatch/package.json +20 -60
- package/node_modules/ms/package.json +19 -57
- package/node_modules/multi-progress/package.json +15 -45
- package/node_modules/normalize-path/package.json +20 -62
- package/node_modules/object-inspect/package.json +48 -80
- package/node_modules/once/package.json +14 -55
- package/node_modules/path-is-absolute/package.json +11 -46
- package/node_modules/picomatch/package.json +23 -59
- package/node_modules/progress/package.json +16 -64
- package/node_modules/qs/package.json +73 -104
- package/node_modules/readdirp/package.json +42 -82
- package/node_modules/require-directory/package.json +24 -56
- package/node_modules/safe-buffer/package.json +5 -37
- package/node_modules/semver/package.json +31 -69
- package/node_modules/side-channel/package.json +65 -97
- package/node_modules/string-width/package.json +54 -96
- package/node_modules/string_decoder/package.json +13 -46
- package/node_modules/strip-ansi/package.json +52 -93
- package/node_modules/superagent/node_modules/form-data/package.json +37 -73
- package/node_modules/superagent/node_modules/readable-stream/package.json +27 -59
- package/node_modules/superagent/package.json +8 -58
- package/node_modules/to-regex-range/package.json +20 -60
- package/node_modules/util-deprecate/package.json +14 -48
- package/node_modules/uuid/package.json +69 -101
- package/node_modules/wrap-ansi/package.json +60 -96
- package/node_modules/wrappy/package.json +16 -49
- package/node_modules/y18n/package.json +38 -72
- package/node_modules/yallist/package.json +15 -54
- package/node_modules/yargs/package.json +67 -98
- package/node_modules/yargs-parser/package.json +47 -82
- package/package.json +62 -64
- package/src/clients/Instance.js +4 -0
- package/src/commands/extensions/delete.js +2 -1
- package/src/commands/extensions/list.js +3 -2
- package/src/commands/firmware/list.js +3 -2
- package/src/commands/images/create.js +2 -2
- package/src/commands/images/delete.js +1 -0
- package/src/commands/images/list.js +3 -2
- package/src/commands/index.js +0 -2
- package/src/commands/{agent → instances}/apps/index.js +3 -3
- package/src/commands/instances/create.js +9 -3
- package/src/commands/{agent → instances}/file.js +2 -2
- package/src/commands/instances/index.js +6 -1
- package/src/commands/instances/input.js +52 -0
- package/src/commands/instances/list.js +3 -2
- package/src/commands/instances/upgrade.js +2 -2
- package/src/commands/projects/create.js +2 -2
- package/src/commands/projects/delete.js +2 -1
- package/src/commands/projects/list.js +3 -2
- package/src/commands/webplayer/create.js +2 -2
- package/src/commands/webplayer/list.js +2 -2
- package/src/error.js +12 -6
- package/src/table.js +1 -1
- package/src/utils.js +19 -40
- package/node_modules/@jridgewell/trace-mapping/src/any-map.ts +0 -166
- package/node_modules/@jridgewell/trace-mapping/src/binary-search.ts +0 -115
- package/node_modules/@jridgewell/trace-mapping/src/by-source.ts +0 -64
- package/node_modules/@jridgewell/trace-mapping/src/resolve.ts +0 -10
- package/node_modules/@jridgewell/trace-mapping/src/sort.ts +0 -45
- package/node_modules/@jridgewell/trace-mapping/src/sourcemap-segment.ts +0 -23
- package/node_modules/@jridgewell/trace-mapping/src/strip-filename.ts +0 -8
- package/node_modules/@jridgewell/trace-mapping/src/trace-mapping.ts +0 -405
- package/node_modules/@jridgewell/trace-mapping/src/types.ts +0 -90
- package/node_modules/generate-password/.eslintrc.yml +0 -18
- package/node_modules/generate-password/.github/workflows/nodejs.yml +0 -33
- package/node_modules/generate-password/CHANGELOG.md +0 -79
- package/node_modules/generate-password/LICENSE +0 -21
- package/node_modules/generate-password/README.md +0 -61
- package/node_modules/generate-password/example.js +0 -28
- package/node_modules/generate-password/main.js +0 -1
- package/node_modules/generate-password/package.json +0 -68
- package/node_modules/generate-password/src/generate.d.ts +0 -51
- package/node_modules/generate-password/src/generate.js +0 -152
- package/node_modules/generate-password/test/coverage.sh +0 -17
- package/node_modules/generate-password/test/esm.mjs +0 -13
- package/node_modules/generate-password/test/generator.js +0 -164
- package/src/clients/TrialAccount.js +0 -76
- package/src/commands/agent/index.js +0 -27
- package/src/commands/signup.js +0 -104
- package/test.sh +0 -2
- /package/src/commands/{agent → instances}/apps/install.js +0 -0
- /package/src/commands/{agent → instances}/ready.js +0 -0
@@ -1,64 +0,0 @@
|
|
1
|
-
import { COLUMN, SOURCES_INDEX, SOURCE_LINE, SOURCE_COLUMN } from './sourcemap-segment';
|
2
|
-
import { memoizedBinarySearch, upperBound } from './binary-search';
|
3
|
-
|
4
|
-
import type { ReverseSegment, SourceMapSegment } from './sourcemap-segment';
|
5
|
-
import type { MemoState } from './binary-search';
|
6
|
-
|
7
|
-
export type Source = {
|
8
|
-
__proto__: null;
|
9
|
-
[line: number]: Exclude<ReverseSegment, [number]>[];
|
10
|
-
};
|
11
|
-
|
12
|
-
// Rebuilds the original source files, with mappings that are ordered by source line/column instead
|
13
|
-
// of generated line/column.
|
14
|
-
export default function buildBySources(
|
15
|
-
decoded: readonly SourceMapSegment[][],
|
16
|
-
memos: MemoState[],
|
17
|
-
): Source[] {
|
18
|
-
const sources: Source[] = memos.map(buildNullArray);
|
19
|
-
|
20
|
-
for (let i = 0; i < decoded.length; i++) {
|
21
|
-
const line = decoded[i];
|
22
|
-
for (let j = 0; j < line.length; j++) {
|
23
|
-
const seg = line[j];
|
24
|
-
if (seg.length === 1) continue;
|
25
|
-
|
26
|
-
const sourceIndex = seg[SOURCES_INDEX];
|
27
|
-
const sourceLine = seg[SOURCE_LINE];
|
28
|
-
const sourceColumn = seg[SOURCE_COLUMN];
|
29
|
-
const originalSource = sources[sourceIndex];
|
30
|
-
const originalLine = (originalSource[sourceLine] ||= []);
|
31
|
-
const memo = memos[sourceIndex];
|
32
|
-
|
33
|
-
// The binary search either found a match, or it found the left-index just before where the
|
34
|
-
// segment should go. Either way, we want to insert after that. And there may be multiple
|
35
|
-
// generated segments associated with an original location, so there may need to move several
|
36
|
-
// indexes before we find where we need to insert.
|
37
|
-
const index = upperBound(
|
38
|
-
originalLine,
|
39
|
-
sourceColumn,
|
40
|
-
memoizedBinarySearch(originalLine, sourceColumn, memo, sourceLine),
|
41
|
-
);
|
42
|
-
|
43
|
-
insert(originalLine, (memo.lastIndex = index + 1), [sourceColumn, i, seg[COLUMN]]);
|
44
|
-
}
|
45
|
-
}
|
46
|
-
|
47
|
-
return sources;
|
48
|
-
}
|
49
|
-
|
50
|
-
function insert<T>(array: T[], index: number, value: T) {
|
51
|
-
for (let i = array.length; i > index; i--) {
|
52
|
-
array[i] = array[i - 1];
|
53
|
-
}
|
54
|
-
array[index] = value;
|
55
|
-
}
|
56
|
-
|
57
|
-
// Null arrays allow us to use ordered index keys without actually allocating contiguous memory like
|
58
|
-
// a real array. We use a null-prototype object to avoid prototype pollution and deoptimizations.
|
59
|
-
// Numeric properties on objects are magically sorted in ascending order by the engine regardless of
|
60
|
-
// the insertion order. So, by setting any numeric keys, even out of order, we'll get ascending
|
61
|
-
// order when iterating with for-in.
|
62
|
-
function buildNullArray<T extends { __proto__: null }>(): T {
|
63
|
-
return { __proto__: null } as T;
|
64
|
-
}
|
@@ -1,10 +0,0 @@
|
|
1
|
-
import resolveUri from '@jridgewell/resolve-uri';
|
2
|
-
|
3
|
-
export default function resolve(input: string, base: string | undefined): string {
|
4
|
-
// The base is always treated as a directory, if it's not empty.
|
5
|
-
// https://github.com/mozilla/source-map/blob/8cb3ee57/lib/util.js#L327
|
6
|
-
// https://github.com/chromium/chromium/blob/da4adbb3/third_party/blink/renderer/devtools/front_end/sdk/SourceMap.js#L400-L401
|
7
|
-
if (base && !base.endsWith('/')) base += '/';
|
8
|
-
|
9
|
-
return resolveUri(input, base);
|
10
|
-
}
|
@@ -1,45 +0,0 @@
|
|
1
|
-
import { COLUMN } from './sourcemap-segment';
|
2
|
-
|
3
|
-
import type { SourceMapSegment } from './sourcemap-segment';
|
4
|
-
|
5
|
-
export default function maybeSort(
|
6
|
-
mappings: SourceMapSegment[][],
|
7
|
-
owned: boolean,
|
8
|
-
): SourceMapSegment[][] {
|
9
|
-
const unsortedIndex = nextUnsortedSegmentLine(mappings, 0);
|
10
|
-
if (unsortedIndex === mappings.length) return mappings;
|
11
|
-
|
12
|
-
// If we own the array (meaning we parsed it from JSON), then we're free to directly mutate it. If
|
13
|
-
// not, we do not want to modify the consumer's input array.
|
14
|
-
if (!owned) mappings = mappings.slice();
|
15
|
-
|
16
|
-
for (let i = unsortedIndex; i < mappings.length; i = nextUnsortedSegmentLine(mappings, i + 1)) {
|
17
|
-
mappings[i] = sortSegments(mappings[i], owned);
|
18
|
-
}
|
19
|
-
return mappings;
|
20
|
-
}
|
21
|
-
|
22
|
-
function nextUnsortedSegmentLine(mappings: SourceMapSegment[][], start: number): number {
|
23
|
-
for (let i = start; i < mappings.length; i++) {
|
24
|
-
if (!isSorted(mappings[i])) return i;
|
25
|
-
}
|
26
|
-
return mappings.length;
|
27
|
-
}
|
28
|
-
|
29
|
-
function isSorted(line: SourceMapSegment[]): boolean {
|
30
|
-
for (let j = 1; j < line.length; j++) {
|
31
|
-
if (line[j][COLUMN] < line[j - 1][COLUMN]) {
|
32
|
-
return false;
|
33
|
-
}
|
34
|
-
}
|
35
|
-
return true;
|
36
|
-
}
|
37
|
-
|
38
|
-
function sortSegments(line: SourceMapSegment[], owned: boolean): SourceMapSegment[] {
|
39
|
-
if (!owned) line = line.slice();
|
40
|
-
return line.sort(sortComparator);
|
41
|
-
}
|
42
|
-
|
43
|
-
function sortComparator(a: SourceMapSegment, b: SourceMapSegment): number {
|
44
|
-
return a[COLUMN] - b[COLUMN];
|
45
|
-
}
|
@@ -1,23 +0,0 @@
|
|
1
|
-
type GeneratedColumn = number;
|
2
|
-
type SourcesIndex = number;
|
3
|
-
type SourceLine = number;
|
4
|
-
type SourceColumn = number;
|
5
|
-
type NamesIndex = number;
|
6
|
-
|
7
|
-
type GeneratedLine = number;
|
8
|
-
|
9
|
-
export type SourceMapSegment =
|
10
|
-
| [GeneratedColumn]
|
11
|
-
| [GeneratedColumn, SourcesIndex, SourceLine, SourceColumn]
|
12
|
-
| [GeneratedColumn, SourcesIndex, SourceLine, SourceColumn, NamesIndex];
|
13
|
-
|
14
|
-
export type ReverseSegment = [SourceColumn, GeneratedLine, GeneratedColumn];
|
15
|
-
|
16
|
-
export const COLUMN = 0;
|
17
|
-
export const SOURCES_INDEX = 1;
|
18
|
-
export const SOURCE_LINE = 2;
|
19
|
-
export const SOURCE_COLUMN = 3;
|
20
|
-
export const NAMES_INDEX = 4;
|
21
|
-
|
22
|
-
export const REV_GENERATED_LINE = 1;
|
23
|
-
export const REV_GENERATED_COLUMN = 2;
|
@@ -1,405 +0,0 @@
|
|
1
|
-
import { encode, decode } from '@jridgewell/sourcemap-codec';
|
2
|
-
|
3
|
-
import resolve from './resolve';
|
4
|
-
import stripFilename from './strip-filename';
|
5
|
-
import maybeSort from './sort';
|
6
|
-
import buildBySources from './by-source';
|
7
|
-
import {
|
8
|
-
memoizedState,
|
9
|
-
memoizedBinarySearch,
|
10
|
-
upperBound,
|
11
|
-
lowerBound,
|
12
|
-
found as bsFound,
|
13
|
-
} from './binary-search';
|
14
|
-
import {
|
15
|
-
SOURCES_INDEX,
|
16
|
-
SOURCE_LINE,
|
17
|
-
SOURCE_COLUMN,
|
18
|
-
NAMES_INDEX,
|
19
|
-
REV_GENERATED_LINE,
|
20
|
-
REV_GENERATED_COLUMN,
|
21
|
-
} from './sourcemap-segment';
|
22
|
-
|
23
|
-
import type { SourceMapSegment, ReverseSegment } from './sourcemap-segment';
|
24
|
-
import type {
|
25
|
-
SourceMapV3,
|
26
|
-
DecodedSourceMap,
|
27
|
-
EncodedSourceMap,
|
28
|
-
InvalidOriginalMapping,
|
29
|
-
OriginalMapping,
|
30
|
-
InvalidGeneratedMapping,
|
31
|
-
GeneratedMapping,
|
32
|
-
SourceMapInput,
|
33
|
-
Needle,
|
34
|
-
SourceNeedle,
|
35
|
-
SourceMap,
|
36
|
-
EachMapping,
|
37
|
-
} from './types';
|
38
|
-
import type { Source } from './by-source';
|
39
|
-
import type { MemoState } from './binary-search';
|
40
|
-
|
41
|
-
export type { SourceMapSegment } from './sourcemap-segment';
|
42
|
-
export type {
|
43
|
-
SourceMapInput,
|
44
|
-
SectionedSourceMapInput,
|
45
|
-
DecodedSourceMap,
|
46
|
-
EncodedSourceMap,
|
47
|
-
SectionedSourceMap,
|
48
|
-
InvalidOriginalMapping,
|
49
|
-
OriginalMapping as Mapping,
|
50
|
-
OriginalMapping,
|
51
|
-
InvalidGeneratedMapping,
|
52
|
-
GeneratedMapping,
|
53
|
-
EachMapping,
|
54
|
-
} from './types';
|
55
|
-
|
56
|
-
const LINE_GTR_ZERO = '`line` must be greater than 0 (lines start at line 1)';
|
57
|
-
const COL_GTR_EQ_ZERO = '`column` must be greater than or equal to 0 (columns start at column 0)';
|
58
|
-
|
59
|
-
export const LEAST_UPPER_BOUND = -1;
|
60
|
-
export const GREATEST_LOWER_BOUND = 1;
|
61
|
-
|
62
|
-
/**
|
63
|
-
* Returns the encoded (VLQ string) form of the SourceMap's mappings field.
|
64
|
-
*/
|
65
|
-
export let encodedMappings: (map: TraceMap) => EncodedSourceMap['mappings'];
|
66
|
-
|
67
|
-
/**
|
68
|
-
* Returns the decoded (array of lines of segments) form of the SourceMap's mappings field.
|
69
|
-
*/
|
70
|
-
export let decodedMappings: (map: TraceMap) => Readonly<DecodedSourceMap['mappings']>;
|
71
|
-
|
72
|
-
/**
|
73
|
-
* A low-level API to find the segment associated with a generated line/column (think, from a
|
74
|
-
* stack trace). Line and column here are 0-based, unlike `originalPositionFor`.
|
75
|
-
*/
|
76
|
-
export let traceSegment: (
|
77
|
-
map: TraceMap,
|
78
|
-
line: number,
|
79
|
-
column: number,
|
80
|
-
) => Readonly<SourceMapSegment> | null;
|
81
|
-
|
82
|
-
/**
|
83
|
-
* A higher-level API to find the source/line/column associated with a generated line/column
|
84
|
-
* (think, from a stack trace). Line is 1-based, but column is 0-based, due to legacy behavior in
|
85
|
-
* `source-map` library.
|
86
|
-
*/
|
87
|
-
export let originalPositionFor: (
|
88
|
-
map: TraceMap,
|
89
|
-
needle: Needle,
|
90
|
-
) => OriginalMapping | InvalidOriginalMapping;
|
91
|
-
|
92
|
-
/**
|
93
|
-
* Finds the source/line/column directly after the mapping returned by originalPositionFor, provided
|
94
|
-
* the found mapping is from the same source and line as the originalPositionFor mapping.
|
95
|
-
*
|
96
|
-
* Eg, in the code `let id = 1`, `originalPositionAfter` could find the mapping associated with `1`
|
97
|
-
* using the same needle that would return `id` when calling `originalPositionFor`.
|
98
|
-
*/
|
99
|
-
export let generatedPositionFor: (
|
100
|
-
map: TraceMap,
|
101
|
-
needle: SourceNeedle,
|
102
|
-
) => GeneratedMapping | InvalidGeneratedMapping;
|
103
|
-
|
104
|
-
/**
|
105
|
-
* Iterates each mapping in generated position order.
|
106
|
-
*/
|
107
|
-
export let eachMapping: (map: TraceMap, cb: (mapping: EachMapping) => void) => void;
|
108
|
-
|
109
|
-
/**
|
110
|
-
* Retrieves the source content for a particular source, if its found. Returns null if not.
|
111
|
-
*/
|
112
|
-
export let sourceContentFor: (map: TraceMap, source: string) => string | null;
|
113
|
-
|
114
|
-
/**
|
115
|
-
* A helper that skips sorting of the input map's mappings array, which can be expensive for larger
|
116
|
-
* maps.
|
117
|
-
*/
|
118
|
-
export let presortedDecodedMap: (map: DecodedSourceMap, mapUrl?: string) => TraceMap;
|
119
|
-
|
120
|
-
/**
|
121
|
-
* Returns a sourcemap object (with decoded mappings) suitable for passing to a library that expects
|
122
|
-
* a sourcemap, or to JSON.stringify.
|
123
|
-
*/
|
124
|
-
export let decodedMap: (
|
125
|
-
map: TraceMap,
|
126
|
-
) => Omit<DecodedSourceMap, 'mappings'> & { mappings: readonly SourceMapSegment[][] };
|
127
|
-
|
128
|
-
/**
|
129
|
-
* Returns a sourcemap object (with encoded mappings) suitable for passing to a library that expects
|
130
|
-
* a sourcemap, or to JSON.stringify.
|
131
|
-
*/
|
132
|
-
export let encodedMap: (map: TraceMap) => EncodedSourceMap;
|
133
|
-
|
134
|
-
export { AnyMap } from './any-map';
|
135
|
-
|
136
|
-
export class TraceMap implements SourceMap {
|
137
|
-
declare version: SourceMapV3['version'];
|
138
|
-
declare file: SourceMapV3['file'];
|
139
|
-
declare names: SourceMapV3['names'];
|
140
|
-
declare sourceRoot: SourceMapV3['sourceRoot'];
|
141
|
-
declare sources: SourceMapV3['sources'];
|
142
|
-
declare sourcesContent: SourceMapV3['sourcesContent'];
|
143
|
-
|
144
|
-
declare resolvedSources: string[];
|
145
|
-
private declare _encoded: string | undefined;
|
146
|
-
|
147
|
-
private declare _decoded: SourceMapSegment[][] | undefined;
|
148
|
-
private _decodedMemo = memoizedState();
|
149
|
-
|
150
|
-
private _bySources: Source[] | undefined = undefined;
|
151
|
-
private _bySourceMemos: MemoState[] | undefined = undefined;
|
152
|
-
|
153
|
-
constructor(map: SourceMapInput, mapUrl?: string | null) {
|
154
|
-
const isString = typeof map === 'string';
|
155
|
-
|
156
|
-
if (!isString && (map as unknown as { _decodedMemo: any })._decodedMemo) return map as TraceMap;
|
157
|
-
|
158
|
-
const parsed = (isString ? JSON.parse(map) : map) as Exclude<SourceMapInput, string | TraceMap>;
|
159
|
-
|
160
|
-
const { version, file, names, sourceRoot, sources, sourcesContent } = parsed;
|
161
|
-
this.version = version;
|
162
|
-
this.file = file;
|
163
|
-
this.names = names;
|
164
|
-
this.sourceRoot = sourceRoot;
|
165
|
-
this.sources = sources;
|
166
|
-
this.sourcesContent = sourcesContent;
|
167
|
-
|
168
|
-
const from = resolve(sourceRoot || '', stripFilename(mapUrl));
|
169
|
-
this.resolvedSources = sources.map((s) => resolve(s || '', from));
|
170
|
-
|
171
|
-
const { mappings } = parsed;
|
172
|
-
if (typeof mappings === 'string') {
|
173
|
-
this._encoded = mappings;
|
174
|
-
this._decoded = undefined;
|
175
|
-
} else {
|
176
|
-
this._encoded = undefined;
|
177
|
-
this._decoded = maybeSort(mappings, isString);
|
178
|
-
}
|
179
|
-
}
|
180
|
-
|
181
|
-
static {
|
182
|
-
encodedMappings = (map) => {
|
183
|
-
return (map._encoded ??= encode(map._decoded!));
|
184
|
-
};
|
185
|
-
|
186
|
-
decodedMappings = (map) => {
|
187
|
-
return (map._decoded ||= decode(map._encoded!));
|
188
|
-
};
|
189
|
-
|
190
|
-
traceSegment = (map, line, column) => {
|
191
|
-
const decoded = decodedMappings(map);
|
192
|
-
|
193
|
-
// It's common for parent source maps to have pointers to lines that have no
|
194
|
-
// mapping (like a "//# sourceMappingURL=") at the end of the child file.
|
195
|
-
if (line >= decoded.length) return null;
|
196
|
-
|
197
|
-
return traceSegmentInternal(
|
198
|
-
decoded[line],
|
199
|
-
map._decodedMemo,
|
200
|
-
line,
|
201
|
-
column,
|
202
|
-
GREATEST_LOWER_BOUND,
|
203
|
-
);
|
204
|
-
};
|
205
|
-
|
206
|
-
originalPositionFor = (map, { line, column, bias }) => {
|
207
|
-
line--;
|
208
|
-
if (line < 0) throw new Error(LINE_GTR_ZERO);
|
209
|
-
if (column < 0) throw new Error(COL_GTR_EQ_ZERO);
|
210
|
-
|
211
|
-
const decoded = decodedMappings(map);
|
212
|
-
|
213
|
-
// It's common for parent source maps to have pointers to lines that have no
|
214
|
-
// mapping (like a "//# sourceMappingURL=") at the end of the child file.
|
215
|
-
if (line >= decoded.length) return OMapping(null, null, null, null);
|
216
|
-
|
217
|
-
const segment = traceSegmentInternal(
|
218
|
-
decoded[line],
|
219
|
-
map._decodedMemo,
|
220
|
-
line,
|
221
|
-
column,
|
222
|
-
bias || GREATEST_LOWER_BOUND,
|
223
|
-
);
|
224
|
-
|
225
|
-
if (segment == null) return OMapping(null, null, null, null);
|
226
|
-
if (segment.length == 1) return OMapping(null, null, null, null);
|
227
|
-
|
228
|
-
const { names, resolvedSources } = map;
|
229
|
-
return OMapping(
|
230
|
-
resolvedSources[segment[SOURCES_INDEX]],
|
231
|
-
segment[SOURCE_LINE] + 1,
|
232
|
-
segment[SOURCE_COLUMN],
|
233
|
-
segment.length === 5 ? names[segment[NAMES_INDEX]] : null,
|
234
|
-
);
|
235
|
-
};
|
236
|
-
|
237
|
-
generatedPositionFor = (map, { source, line, column, bias }) => {
|
238
|
-
line--;
|
239
|
-
if (line < 0) throw new Error(LINE_GTR_ZERO);
|
240
|
-
if (column < 0) throw new Error(COL_GTR_EQ_ZERO);
|
241
|
-
|
242
|
-
const { sources, resolvedSources } = map;
|
243
|
-
let sourceIndex = sources.indexOf(source);
|
244
|
-
if (sourceIndex === -1) sourceIndex = resolvedSources.indexOf(source);
|
245
|
-
if (sourceIndex === -1) return GMapping(null, null);
|
246
|
-
|
247
|
-
const generated = (map._bySources ||= buildBySources(
|
248
|
-
decodedMappings(map),
|
249
|
-
(map._bySourceMemos = sources.map(memoizedState)),
|
250
|
-
));
|
251
|
-
const memos = map._bySourceMemos!;
|
252
|
-
|
253
|
-
const segments = generated[sourceIndex][line];
|
254
|
-
|
255
|
-
if (segments == null) return GMapping(null, null);
|
256
|
-
|
257
|
-
const segment = traceSegmentInternal(
|
258
|
-
segments,
|
259
|
-
memos[sourceIndex],
|
260
|
-
line,
|
261
|
-
column,
|
262
|
-
bias || GREATEST_LOWER_BOUND,
|
263
|
-
);
|
264
|
-
|
265
|
-
if (segment == null) return GMapping(null, null);
|
266
|
-
return GMapping(segment[REV_GENERATED_LINE] + 1, segment[REV_GENERATED_COLUMN]);
|
267
|
-
};
|
268
|
-
|
269
|
-
eachMapping = (map, cb) => {
|
270
|
-
const decoded = decodedMappings(map);
|
271
|
-
const { names, resolvedSources } = map;
|
272
|
-
|
273
|
-
for (let i = 0; i < decoded.length; i++) {
|
274
|
-
const line = decoded[i];
|
275
|
-
for (let j = 0; j < line.length; j++) {
|
276
|
-
const seg = line[j];
|
277
|
-
|
278
|
-
const generatedLine = i + 1;
|
279
|
-
const generatedColumn = seg[0];
|
280
|
-
let source = null;
|
281
|
-
let originalLine = null;
|
282
|
-
let originalColumn = null;
|
283
|
-
let name = null;
|
284
|
-
if (seg.length !== 1) {
|
285
|
-
source = resolvedSources[seg[1]];
|
286
|
-
originalLine = seg[2] + 1;
|
287
|
-
originalColumn = seg[3];
|
288
|
-
}
|
289
|
-
if (seg.length === 5) name = names[seg[4]];
|
290
|
-
|
291
|
-
cb({
|
292
|
-
generatedLine,
|
293
|
-
generatedColumn,
|
294
|
-
source,
|
295
|
-
originalLine,
|
296
|
-
originalColumn,
|
297
|
-
name,
|
298
|
-
} as EachMapping);
|
299
|
-
}
|
300
|
-
}
|
301
|
-
};
|
302
|
-
|
303
|
-
sourceContentFor = (map, source) => {
|
304
|
-
const { sources, resolvedSources, sourcesContent } = map;
|
305
|
-
if (sourcesContent == null) return null;
|
306
|
-
|
307
|
-
let index = sources.indexOf(source);
|
308
|
-
if (index === -1) index = resolvedSources.indexOf(source);
|
309
|
-
|
310
|
-
return index === -1 ? null : sourcesContent[index];
|
311
|
-
};
|
312
|
-
|
313
|
-
presortedDecodedMap = (map, mapUrl) => {
|
314
|
-
const clone = Object.assign({}, map);
|
315
|
-
clone.mappings = [];
|
316
|
-
const tracer = new TraceMap(clone, mapUrl);
|
317
|
-
tracer._decoded = map.mappings;
|
318
|
-
return tracer;
|
319
|
-
};
|
320
|
-
|
321
|
-
decodedMap = (map) => {
|
322
|
-
return {
|
323
|
-
version: 3,
|
324
|
-
file: map.file,
|
325
|
-
names: map.names,
|
326
|
-
sourceRoot: map.sourceRoot,
|
327
|
-
sources: map.sources,
|
328
|
-
sourcesContent: map.sourcesContent,
|
329
|
-
mappings: decodedMappings(map),
|
330
|
-
};
|
331
|
-
};
|
332
|
-
|
333
|
-
encodedMap = (map) => {
|
334
|
-
return {
|
335
|
-
version: 3,
|
336
|
-
file: map.file,
|
337
|
-
names: map.names,
|
338
|
-
sourceRoot: map.sourceRoot,
|
339
|
-
sources: map.sources,
|
340
|
-
sourcesContent: map.sourcesContent,
|
341
|
-
mappings: encodedMappings(map),
|
342
|
-
};
|
343
|
-
};
|
344
|
-
}
|
345
|
-
}
|
346
|
-
|
347
|
-
function OMapping(
|
348
|
-
source: null,
|
349
|
-
line: null,
|
350
|
-
column: null,
|
351
|
-
name: null,
|
352
|
-
): OriginalMapping | InvalidOriginalMapping;
|
353
|
-
function OMapping(
|
354
|
-
source: string,
|
355
|
-
line: number,
|
356
|
-
column: number,
|
357
|
-
name: string | null,
|
358
|
-
): OriginalMapping | InvalidOriginalMapping;
|
359
|
-
function OMapping(
|
360
|
-
source: string | null,
|
361
|
-
line: number | null,
|
362
|
-
column: number | null,
|
363
|
-
name: string | null,
|
364
|
-
): OriginalMapping | InvalidOriginalMapping {
|
365
|
-
return { source, line, column, name } as any;
|
366
|
-
}
|
367
|
-
|
368
|
-
function GMapping(line: null, column: null): GeneratedMapping | InvalidGeneratedMapping;
|
369
|
-
function GMapping(line: number, column: number): GeneratedMapping | InvalidGeneratedMapping;
|
370
|
-
function GMapping(
|
371
|
-
line: number | null,
|
372
|
-
column: number | null,
|
373
|
-
): GeneratedMapping | InvalidGeneratedMapping {
|
374
|
-
return { line, column } as any;
|
375
|
-
}
|
376
|
-
|
377
|
-
function traceSegmentInternal(
|
378
|
-
segments: SourceMapSegment[],
|
379
|
-
memo: MemoState,
|
380
|
-
line: number,
|
381
|
-
column: number,
|
382
|
-
bias: typeof LEAST_UPPER_BOUND | typeof GREATEST_LOWER_BOUND,
|
383
|
-
): Readonly<SourceMapSegment> | null;
|
384
|
-
function traceSegmentInternal(
|
385
|
-
segments: ReverseSegment[],
|
386
|
-
memo: MemoState,
|
387
|
-
line: number,
|
388
|
-
column: number,
|
389
|
-
bias: typeof LEAST_UPPER_BOUND | typeof GREATEST_LOWER_BOUND,
|
390
|
-
): Readonly<ReverseSegment> | null;
|
391
|
-
function traceSegmentInternal(
|
392
|
-
segments: SourceMapSegment[] | ReverseSegment[],
|
393
|
-
memo: MemoState,
|
394
|
-
line: number,
|
395
|
-
column: number,
|
396
|
-
bias: typeof LEAST_UPPER_BOUND | typeof GREATEST_LOWER_BOUND,
|
397
|
-
): Readonly<SourceMapSegment | ReverseSegment> | null {
|
398
|
-
let index = memoizedBinarySearch(segments, column, memo, line);
|
399
|
-
if (bsFound) {
|
400
|
-
index = (bias === LEAST_UPPER_BOUND ? upperBound : lowerBound)(segments, column, index);
|
401
|
-
} else if (bias === LEAST_UPPER_BOUND) index++;
|
402
|
-
|
403
|
-
if (index === -1 || index === segments.length) return null;
|
404
|
-
return segments[index];
|
405
|
-
}
|
@@ -1,90 +0,0 @@
|
|
1
|
-
import type { SourceMapSegment } from './sourcemap-segment';
|
2
|
-
import type { TraceMap } from './trace-mapping';
|
3
|
-
|
4
|
-
export interface SourceMapV3 {
|
5
|
-
file?: string | null;
|
6
|
-
names: string[];
|
7
|
-
sourceRoot?: string;
|
8
|
-
sources: (string | null)[];
|
9
|
-
sourcesContent?: (string | null)[];
|
10
|
-
version: 3;
|
11
|
-
}
|
12
|
-
|
13
|
-
export interface EncodedSourceMap extends SourceMapV3 {
|
14
|
-
mappings: string;
|
15
|
-
}
|
16
|
-
|
17
|
-
export interface DecodedSourceMap extends SourceMapV3 {
|
18
|
-
mappings: SourceMapSegment[][];
|
19
|
-
}
|
20
|
-
|
21
|
-
export interface Section {
|
22
|
-
offset: {
|
23
|
-
line: number;
|
24
|
-
column: number;
|
25
|
-
};
|
26
|
-
map: EncodedSourceMap | DecodedSourceMap | SectionedSourceMap;
|
27
|
-
}
|
28
|
-
|
29
|
-
export interface SectionedSourceMap {
|
30
|
-
file?: string | null;
|
31
|
-
sections: Section[];
|
32
|
-
version: 3;
|
33
|
-
}
|
34
|
-
|
35
|
-
export type OriginalMapping = {
|
36
|
-
source: string | null;
|
37
|
-
line: number;
|
38
|
-
column: number;
|
39
|
-
name: string | null;
|
40
|
-
};
|
41
|
-
|
42
|
-
export type InvalidOriginalMapping = {
|
43
|
-
source: null;
|
44
|
-
line: null;
|
45
|
-
column: null;
|
46
|
-
name: null;
|
47
|
-
};
|
48
|
-
|
49
|
-
export type GeneratedMapping = {
|
50
|
-
line: number;
|
51
|
-
column: number;
|
52
|
-
};
|
53
|
-
export type InvalidGeneratedMapping = {
|
54
|
-
line: null;
|
55
|
-
column: null;
|
56
|
-
};
|
57
|
-
|
58
|
-
export type SourceMapInput = string | EncodedSourceMap | DecodedSourceMap | TraceMap;
|
59
|
-
export type SectionedSourceMapInput = SourceMapInput | SectionedSourceMap;
|
60
|
-
|
61
|
-
export type Needle = { line: number; column: number; bias?: 1 | -1 };
|
62
|
-
export type SourceNeedle = { source: string; line: number; column: number; bias?: 1 | -1 };
|
63
|
-
|
64
|
-
export type EachMapping =
|
65
|
-
| {
|
66
|
-
generatedLine: number;
|
67
|
-
generatedColumn: number;
|
68
|
-
source: null;
|
69
|
-
originalLine: null;
|
70
|
-
originalColumn: null;
|
71
|
-
name: null;
|
72
|
-
}
|
73
|
-
| {
|
74
|
-
generatedLine: number;
|
75
|
-
generatedColumn: number;
|
76
|
-
source: string | null;
|
77
|
-
originalLine: number;
|
78
|
-
originalColumn: number;
|
79
|
-
name: string | null;
|
80
|
-
};
|
81
|
-
|
82
|
-
export abstract class SourceMap {
|
83
|
-
declare version: SourceMapV3['version'];
|
84
|
-
declare file: SourceMapV3['file'];
|
85
|
-
declare names: SourceMapV3['names'];
|
86
|
-
declare sourceRoot: SourceMapV3['sourceRoot'];
|
87
|
-
declare sources: SourceMapV3['sources'];
|
88
|
-
declare sourcesContent: SourceMapV3['sourcesContent'];
|
89
|
-
declare resolvedSources: SourceMapV3['sources'];
|
90
|
-
}
|
@@ -1,33 +0,0 @@
|
|
1
|
-
# This workflow will do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node
|
2
|
-
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
|
3
|
-
|
4
|
-
name: Node.js CI
|
5
|
-
|
6
|
-
on:
|
7
|
-
push:
|
8
|
-
branches: [ master ]
|
9
|
-
pull_request:
|
10
|
-
branches: [ master ]
|
11
|
-
|
12
|
-
jobs:
|
13
|
-
build:
|
14
|
-
|
15
|
-
runs-on: ubuntu-latest
|
16
|
-
|
17
|
-
strategy:
|
18
|
-
matrix:
|
19
|
-
node-version: [12.x, 14.x, 16.x]
|
20
|
-
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
21
|
-
|
22
|
-
steps:
|
23
|
-
- uses: actions/checkout@v2
|
24
|
-
- name: Use Node.js ${{ matrix.node-version }}
|
25
|
-
uses: actions/setup-node@v2
|
26
|
-
with:
|
27
|
-
node-version: ${{ matrix.node-version }}
|
28
|
-
cache: 'npm'
|
29
|
-
- run: npm ci
|
30
|
-
- run: npm run build --if-present
|
31
|
-
- run: npm test
|
32
|
-
- run: npm run lint
|
33
|
-
- run: npm run coverage
|