@utoo/pack-shared 1.4.7-alpha.2 → 1.4.8-alpha.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/cjs/utils.d.ts +5 -0
- package/cjs/utils.js +25 -1
- package/esm/utils.d.ts +5 -0
- package/esm/utils.js +24 -1
- package/package.json +1 -1
package/cjs/utils.d.ts
CHANGED
|
@@ -6,7 +6,12 @@ export declare class ModuleBuildError extends Error {
|
|
|
6
6
|
export interface ResultWithIssues {
|
|
7
7
|
issues: Issue[];
|
|
8
8
|
}
|
|
9
|
+
type IssueKey = `${Issue["severity"]}-${Issue["filePath"]}-${string}-${string}`;
|
|
10
|
+
export type IssuesMap = Map<IssueKey, Issue>;
|
|
11
|
+
export type EntryIssuesMap = Map<string, IssuesMap>;
|
|
12
|
+
export declare function getIssueKey(issue: Issue): IssueKey;
|
|
9
13
|
export declare function processIssues(result: ResultWithIssues, throwIssue: boolean, logErrors: boolean): void;
|
|
14
|
+
export declare function processIssues(currentEntryIssues: EntryIssuesMap, key: string, result: ResultWithIssues, throwIssue: boolean, logErrors: boolean): void;
|
|
10
15
|
export declare function isWellKnownError(issue: Issue): boolean;
|
|
11
16
|
export declare function rustifyEnv(env: Record<string, string>): RustifiedEnv;
|
|
12
17
|
/**
|
package/cjs/utils.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ModuleBuildError = void 0;
|
|
4
|
+
exports.getIssueKey = getIssueKey;
|
|
4
5
|
exports.processIssues = processIssues;
|
|
5
6
|
exports.isWellKnownError = isWellKnownError;
|
|
6
7
|
exports.rustifyEnv = rustifyEnv;
|
|
@@ -15,13 +16,36 @@ class ModuleBuildError extends Error {
|
|
|
15
16
|
}
|
|
16
17
|
}
|
|
17
18
|
exports.ModuleBuildError = ModuleBuildError;
|
|
18
|
-
function
|
|
19
|
+
function getIssueKey(issue) {
|
|
20
|
+
return `${issue.severity}-${issue.filePath}-${JSON.stringify(issue.title)}-${JSON.stringify(issue.description)}`;
|
|
21
|
+
}
|
|
22
|
+
function processIssues(resultOrCurrentEntryIssues, throwIssueOrKey, logErrorsOrResult, maybeThrowIssue, maybeLogErrors) {
|
|
23
|
+
const currentEntryIssues = resultOrCurrentEntryIssues instanceof Map
|
|
24
|
+
? resultOrCurrentEntryIssues
|
|
25
|
+
: undefined;
|
|
26
|
+
const key = resultOrCurrentEntryIssues instanceof Map
|
|
27
|
+
? throwIssueOrKey
|
|
28
|
+
: undefined;
|
|
29
|
+
const result = currentEntryIssues
|
|
30
|
+
? logErrorsOrResult
|
|
31
|
+
: resultOrCurrentEntryIssues;
|
|
32
|
+
const throwIssue = currentEntryIssues
|
|
33
|
+
? maybeThrowIssue
|
|
34
|
+
: throwIssueOrKey;
|
|
35
|
+
const logErrors = currentEntryIssues
|
|
36
|
+
? maybeLogErrors
|
|
37
|
+
: logErrorsOrResult;
|
|
38
|
+
const newIssues = currentEntryIssues ? new Map() : undefined;
|
|
39
|
+
if (currentEntryIssues && key) {
|
|
40
|
+
currentEntryIssues.set(key, newIssues);
|
|
41
|
+
}
|
|
19
42
|
const relevantIssues = new Set();
|
|
20
43
|
for (const issue of result.issues) {
|
|
21
44
|
if (issue.severity !== "error" &&
|
|
22
45
|
issue.severity !== "fatal" &&
|
|
23
46
|
issue.severity !== "warning")
|
|
24
47
|
continue;
|
|
48
|
+
newIssues === null || newIssues === void 0 ? void 0 : newIssues.set(getIssueKey(issue), issue);
|
|
25
49
|
if (issue.severity !== "warning") {
|
|
26
50
|
if (throwIssue) {
|
|
27
51
|
const formatted = (0, issue_1.formatIssue)(issue);
|
package/esm/utils.d.ts
CHANGED
|
@@ -6,7 +6,12 @@ export declare class ModuleBuildError extends Error {
|
|
|
6
6
|
export interface ResultWithIssues {
|
|
7
7
|
issues: Issue[];
|
|
8
8
|
}
|
|
9
|
+
type IssueKey = `${Issue["severity"]}-${Issue["filePath"]}-${string}-${string}`;
|
|
10
|
+
export type IssuesMap = Map<IssueKey, Issue>;
|
|
11
|
+
export type EntryIssuesMap = Map<string, IssuesMap>;
|
|
12
|
+
export declare function getIssueKey(issue: Issue): IssueKey;
|
|
9
13
|
export declare function processIssues(result: ResultWithIssues, throwIssue: boolean, logErrors: boolean): void;
|
|
14
|
+
export declare function processIssues(currentEntryIssues: EntryIssuesMap, key: string, result: ResultWithIssues, throwIssue: boolean, logErrors: boolean): void;
|
|
10
15
|
export declare function isWellKnownError(issue: Issue): boolean;
|
|
11
16
|
export declare function rustifyEnv(env: Record<string, string>): RustifiedEnv;
|
|
12
17
|
/**
|
package/esm/utils.js
CHANGED
|
@@ -6,13 +6,36 @@ export class ModuleBuildError extends Error {
|
|
|
6
6
|
this.name = "ModuleBuildError";
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
|
-
export function
|
|
9
|
+
export function getIssueKey(issue) {
|
|
10
|
+
return `${issue.severity}-${issue.filePath}-${JSON.stringify(issue.title)}-${JSON.stringify(issue.description)}`;
|
|
11
|
+
}
|
|
12
|
+
export function processIssues(resultOrCurrentEntryIssues, throwIssueOrKey, logErrorsOrResult, maybeThrowIssue, maybeLogErrors) {
|
|
13
|
+
const currentEntryIssues = resultOrCurrentEntryIssues instanceof Map
|
|
14
|
+
? resultOrCurrentEntryIssues
|
|
15
|
+
: undefined;
|
|
16
|
+
const key = resultOrCurrentEntryIssues instanceof Map
|
|
17
|
+
? throwIssueOrKey
|
|
18
|
+
: undefined;
|
|
19
|
+
const result = currentEntryIssues
|
|
20
|
+
? logErrorsOrResult
|
|
21
|
+
: resultOrCurrentEntryIssues;
|
|
22
|
+
const throwIssue = currentEntryIssues
|
|
23
|
+
? maybeThrowIssue
|
|
24
|
+
: throwIssueOrKey;
|
|
25
|
+
const logErrors = currentEntryIssues
|
|
26
|
+
? maybeLogErrors
|
|
27
|
+
: logErrorsOrResult;
|
|
28
|
+
const newIssues = currentEntryIssues ? new Map() : undefined;
|
|
29
|
+
if (currentEntryIssues && key) {
|
|
30
|
+
currentEntryIssues.set(key, newIssues);
|
|
31
|
+
}
|
|
10
32
|
const relevantIssues = new Set();
|
|
11
33
|
for (const issue of result.issues) {
|
|
12
34
|
if (issue.severity !== "error" &&
|
|
13
35
|
issue.severity !== "fatal" &&
|
|
14
36
|
issue.severity !== "warning")
|
|
15
37
|
continue;
|
|
38
|
+
newIssues === null || newIssues === void 0 ? void 0 : newIssues.set(getIssueKey(issue), issue);
|
|
16
39
|
if (issue.severity !== "warning") {
|
|
17
40
|
if (throwIssue) {
|
|
18
41
|
const formatted = formatIssue(issue);
|