@lwc/sfdc-lwc-compiler 13.2.2 → 13.2.3-alpha.1
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/dist/main.d.ts +1 -0
- package/dist/main.js +4 -1
- package/dist/main.js.map +1 -1
- package/dist/utils/sarif.d.ts +55 -0
- package/dist/utils/sarif.js +109 -0
- package/dist/utils/sarif.js.map +1 -0
- package/package.json +5 -5
package/dist/main.d.ts
CHANGED
package/dist/main.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.compile = void 0;
|
|
3
|
+
exports.convertCompilerOutputToSarif = exports.convertDiagnosticsToSarif = exports.compile = void 0;
|
|
4
4
|
var compile_1 = require("./compile");
|
|
5
5
|
Object.defineProperty(exports, "compile", { enumerable: true, get: function () { return compile_1.compile; } });
|
|
6
|
+
var sarif_1 = require("./utils/sarif");
|
|
7
|
+
Object.defineProperty(exports, "convertDiagnosticsToSarif", { enumerable: true, get: function () { return sarif_1.convertDiagnosticsToSarif; } });
|
|
8
|
+
Object.defineProperty(exports, "convertCompilerOutputToSarif", { enumerable: true, get: function () { return sarif_1.convertCompilerOutputToSarif; } });
|
|
6
9
|
//# sourceMappingURL=main.js.map
|
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";;;AAAA,qCAAoC;AAA3B,kGAAA,OAAO,OAAA"}
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";;;AAAA,qCAAoC;AAA3B,kGAAA,OAAO,OAAA;AAChB,uCAAwF;AAA/E,kHAAA,yBAAyB,OAAA;AAAE,qHAAA,4BAA4B,OAAA"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { CompilerDiagnostic } from '@lwc/errors';
|
|
2
|
+
import type { PlatformCompilerOutput } from '../compile';
|
|
3
|
+
export interface SarifLog {
|
|
4
|
+
version: '2.1.0';
|
|
5
|
+
$schema?: string;
|
|
6
|
+
runs: SarifRun[];
|
|
7
|
+
}
|
|
8
|
+
export interface SarifRun {
|
|
9
|
+
tool: {
|
|
10
|
+
driver: {
|
|
11
|
+
name: string;
|
|
12
|
+
rules?: SarifReportingDescriptor[];
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
results: SarifResult[];
|
|
16
|
+
}
|
|
17
|
+
export interface SarifReportingDescriptor {
|
|
18
|
+
id: string;
|
|
19
|
+
name?: string;
|
|
20
|
+
shortDescription?: {
|
|
21
|
+
text: string;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export interface SarifResult {
|
|
25
|
+
ruleId?: string;
|
|
26
|
+
level?: 'error' | 'warning' | 'note';
|
|
27
|
+
message: {
|
|
28
|
+
text: string;
|
|
29
|
+
};
|
|
30
|
+
locations?: Array<{
|
|
31
|
+
physicalLocation: {
|
|
32
|
+
artifactLocation?: {
|
|
33
|
+
uri?: string;
|
|
34
|
+
};
|
|
35
|
+
region?: {
|
|
36
|
+
startLine?: number;
|
|
37
|
+
startColumn?: number;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
}>;
|
|
41
|
+
properties?: Record<string, unknown>;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Convert an array of LWC CompilerDiagnostics into a SARIF 2.1.0 log.
|
|
45
|
+
*/
|
|
46
|
+
export declare function convertDiagnosticsToSarif(diagnostics: CompilerDiagnostic[], options?: {
|
|
47
|
+
toolName?: string;
|
|
48
|
+
}): SarifLog;
|
|
49
|
+
/**
|
|
50
|
+
* Convert a complete PlatformCompilerOutput into a SARIF 2.1.0 log, merging
|
|
51
|
+
* top-level and per-bundle diagnostics with de-duplication.
|
|
52
|
+
*/
|
|
53
|
+
export declare function convertCompilerOutputToSarif(output: PlatformCompilerOutput, options?: {
|
|
54
|
+
toolName?: string;
|
|
55
|
+
}): SarifLog;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.convertDiagnosticsToSarif = convertDiagnosticsToSarif;
|
|
4
|
+
exports.convertCompilerOutputToSarif = convertCompilerOutputToSarif;
|
|
5
|
+
function toSarifLevel(level) {
|
|
6
|
+
// DiagnosticLevel: Fatal=0, Error=1, Warning=2, Log=3
|
|
7
|
+
if (level === 0 || level === 1)
|
|
8
|
+
return 'error';
|
|
9
|
+
if (level === 2)
|
|
10
|
+
return 'warning';
|
|
11
|
+
return 'note';
|
|
12
|
+
}
|
|
13
|
+
function ruleIdFromDiagnostic(d) {
|
|
14
|
+
const code = d.code;
|
|
15
|
+
if (code === undefined || code === null)
|
|
16
|
+
return undefined;
|
|
17
|
+
return typeof code === 'number' ? `LWC${code}` : String(code);
|
|
18
|
+
}
|
|
19
|
+
function collectAllDiagnostics(output) {
|
|
20
|
+
const merged = [];
|
|
21
|
+
const seen = new Set();
|
|
22
|
+
const add = (d) => {
|
|
23
|
+
const key = [
|
|
24
|
+
d.code ?? '',
|
|
25
|
+
d.message ?? '',
|
|
26
|
+
d.filename ?? '',
|
|
27
|
+
d.location?.line ?? '',
|
|
28
|
+
d.location?.column ?? '',
|
|
29
|
+
].join('|');
|
|
30
|
+
if (!seen.has(key)) {
|
|
31
|
+
seen.add(key);
|
|
32
|
+
merged.push(d);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
(output.diagnostics || []).forEach(add);
|
|
36
|
+
(output.results || []).forEach((r) => (r.diagnostics || []).forEach(add));
|
|
37
|
+
return merged;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Convert an array of LWC CompilerDiagnostics into a SARIF 2.1.0 log.
|
|
41
|
+
*/
|
|
42
|
+
function convertDiagnosticsToSarif(diagnostics, options) {
|
|
43
|
+
const toolName = options?.toolName ?? '@lwc/sfdc-lwc-compiler';
|
|
44
|
+
const rulesById = new Map();
|
|
45
|
+
const results = diagnostics.map((d) => {
|
|
46
|
+
const ruleId = ruleIdFromDiagnostic(d);
|
|
47
|
+
if (ruleId && !rulesById.has(ruleId)) {
|
|
48
|
+
// Use the prefix before ':' if present as a short description, e.g. "LWC1002: ..."
|
|
49
|
+
const short = typeof d.message === 'string' ? d.message.split(':')[0] : '';
|
|
50
|
+
rulesById.set(ruleId, {
|
|
51
|
+
id: ruleId,
|
|
52
|
+
name: ruleId,
|
|
53
|
+
shortDescription: short ? { text: short } : undefined,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
const location = d.location;
|
|
57
|
+
const filename = d.filename;
|
|
58
|
+
const sarifLoc = filename || location
|
|
59
|
+
? [
|
|
60
|
+
{
|
|
61
|
+
physicalLocation: {
|
|
62
|
+
artifactLocation: filename ? { uri: filename } : undefined,
|
|
63
|
+
region: location
|
|
64
|
+
? {
|
|
65
|
+
startLine: location.line,
|
|
66
|
+
startColumn: location.column,
|
|
67
|
+
}
|
|
68
|
+
: undefined,
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
]
|
|
72
|
+
: undefined;
|
|
73
|
+
return {
|
|
74
|
+
ruleId,
|
|
75
|
+
level: toSarifLevel(d.level),
|
|
76
|
+
message: { text: d.message || '' },
|
|
77
|
+
locations: sarifLoc,
|
|
78
|
+
properties: {
|
|
79
|
+
code: d.code,
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
});
|
|
83
|
+
const rules = Array.from(rulesById.values());
|
|
84
|
+
const log = {
|
|
85
|
+
version: '2.1.0',
|
|
86
|
+
$schema: 'https://raw.githubusercontent.com/oasis-tcs/sarif-spec/master/Schemata/sarif-schema-2.1.0.json',
|
|
87
|
+
runs: [
|
|
88
|
+
{
|
|
89
|
+
tool: {
|
|
90
|
+
driver: {
|
|
91
|
+
name: toolName,
|
|
92
|
+
rules: rules.length ? rules : undefined,
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
results: results || [],
|
|
96
|
+
},
|
|
97
|
+
],
|
|
98
|
+
};
|
|
99
|
+
return log;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Convert a complete PlatformCompilerOutput into a SARIF 2.1.0 log, merging
|
|
103
|
+
* top-level and per-bundle diagnostics with de-duplication.
|
|
104
|
+
*/
|
|
105
|
+
function convertCompilerOutputToSarif(output, options) {
|
|
106
|
+
const diagnostics = collectAllDiagnostics(output);
|
|
107
|
+
return convertDiagnosticsToSarif(diagnostics, options);
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=sarif.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sarif.js","sourceRoot":"","sources":["../../src/utils/sarif.ts"],"names":[],"mappings":";;AA+EA,8DAsEC;AAMD,oEAMC;AA1HD,SAAS,YAAY,CAAC,KAAkC;IACpD,sDAAsD;IACtD,IAAI,KAAK,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC;QAAE,OAAO,OAAO,CAAC;IAC/C,IAAI,KAAK,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IAClC,OAAO,MAAM,CAAC;AAClB,CAAC;AAED,SAAS,oBAAoB,CAAC,CAAqB;IAC/C,MAAM,IAAI,GAAI,CAAS,CAAC,IAAmC,CAAC;IAC5D,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,IAAI;QAAE,OAAO,SAAS,CAAC;IAC1D,OAAO,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAClE,CAAC;AAED,SAAS,qBAAqB,CAAC,MAA8B;IACzD,MAAM,MAAM,GAAyB,EAAE,CAAC;IACxC,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAE/B,MAAM,GAAG,GAAG,CAAC,CAAqB,EAAE,EAAE;QAClC,MAA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EACH,gGAAgG;QACpG,IAAI,EAAE;YACF;gBACI,IAAI,EAAE;oBACF,MAAM,EAAE;wBACJ,IAAI,EAAE,QAAQ;wBACd,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS;qBAC1C;iBACJ;gBACD,OAAO,EAAE,OAAO,IAAI,EAAE;aACzB;SACJ;KACJ,CAAC;IAEF,OAAO,GAAG,CAAC;AACf,CAAC;AAED;;;GAGG;AACH,SAAgB,4BAA4B,CACxC,MAA8B,EAC9B,OAA+B;IAE/B,MAAM,WAAW,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAC;IAClD,OAAO,yBAAyB,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;AAC3D,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lwc/sfdc-lwc-compiler",
|
|
3
3
|
"description": "LWC compiler for SFDC platform",
|
|
4
|
-
"version": "13.2.
|
|
4
|
+
"version": "13.2.3-alpha.1+9137e7d",
|
|
5
5
|
"main": "dist/main.js",
|
|
6
6
|
"typings": "dist/main.d.ts",
|
|
7
7
|
"files": [
|
|
@@ -27,11 +27,11 @@
|
|
|
27
27
|
"@babel/traverse": "7.27.4",
|
|
28
28
|
"@babel/types": "7.27.6",
|
|
29
29
|
"@komaci/esm-generator": "258.0.0",
|
|
30
|
-
"@lwc/dev-server-plugin-lex": "13.2.
|
|
30
|
+
"@lwc/dev-server-plugin-lex": "13.2.3-alpha.1+9137e7d",
|
|
31
31
|
"@lwc/eslint-plugin-lwc": "3.0.0-beta.2",
|
|
32
32
|
"@lwc/eslint-plugin-lwc-platform": "6.0.0-beta.7",
|
|
33
|
-
"@lwc/metadata": "13.2.
|
|
34
|
-
"@lwc/sfdc-compiler-utils": "13.2.
|
|
33
|
+
"@lwc/metadata": "13.2.3-alpha.1+9137e7d",
|
|
34
|
+
"@lwc/sfdc-compiler-utils": "13.2.3-alpha.1+9137e7d",
|
|
35
35
|
"@rollup/plugin-babel": "^6.0.4",
|
|
36
36
|
"@rollup/plugin-replace": "^6.0.2",
|
|
37
37
|
"@rollup/wasm-node": "4.10.0",
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
"@lwc/errors": ">=8",
|
|
71
71
|
"@lwc/template-compiler": ">=8"
|
|
72
72
|
},
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "9137e7dd97eee7e93f2a433df890f13d4cb2d12f"
|
|
74
74
|
}
|