@sverka/compiler 0.1.4 → 0.1.5
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/index.mjs +32 -46
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -482,6 +482,28 @@ var GithubTargetError = class extends Error {
|
|
|
482
482
|
}
|
|
483
483
|
};
|
|
484
484
|
//#endregion
|
|
485
|
+
//#region src/job-ids.ts
|
|
486
|
+
/**
|
|
487
|
+
* Build a mapping from full step IDs (e.g., "ci/lint") to CI-safe
|
|
488
|
+
* job IDs (e.g., "lint"). If there are collisions, append a suffix.
|
|
489
|
+
*/
|
|
490
|
+
function buildJobIdMap(steps) {
|
|
491
|
+
const map = /* @__PURE__ */ new Map();
|
|
492
|
+
const used = /* @__PURE__ */ new Set();
|
|
493
|
+
for (const step of steps) {
|
|
494
|
+
const shortId = step.id.includes("/") ? step.id.split("/").pop() : step.id;
|
|
495
|
+
let jobId = shortId;
|
|
496
|
+
let suffix = 1;
|
|
497
|
+
while (used.has(jobId)) {
|
|
498
|
+
jobId = `${shortId}-${suffix}`;
|
|
499
|
+
suffix++;
|
|
500
|
+
}
|
|
501
|
+
used.add(jobId);
|
|
502
|
+
map.set(step.id, jobId);
|
|
503
|
+
}
|
|
504
|
+
return map;
|
|
505
|
+
}
|
|
506
|
+
//#endregion
|
|
485
507
|
//#region src/stdout-capture.ts
|
|
486
508
|
/**
|
|
487
509
|
* Quote a literal string using single quotes for a POSIX shell.
|
|
@@ -553,7 +575,7 @@ function setupSteps(config) {
|
|
|
553
575
|
*/
|
|
554
576
|
function lowerSinglePipeline(pipeline, config) {
|
|
555
577
|
const reachableSteps = filterReachableSteps$1(pipeline);
|
|
556
|
-
const jobIdMap = buildJobIdMap
|
|
578
|
+
const jobIdMap = buildJobIdMap(reachableSteps);
|
|
557
579
|
return assemblePipelineTarget(pipeline, lowerTriggers$1(pipeline.entries, pipeline.inputs), lowerStepsWithCalls(reachableSteps, jobIdMap, pipeline.id, config));
|
|
558
580
|
}
|
|
559
581
|
/**
|
|
@@ -622,7 +644,7 @@ function lowerPipelineInGraph(pipeline, isCalled, config) {
|
|
|
622
644
|
const hasEntries = pipeline.entries.length > 0;
|
|
623
645
|
if (!hasEntries && !isCalled) return void 0;
|
|
624
646
|
const reachableSteps = hasEntries ? filterReachableSteps$1(pipeline) : pipeline.steps;
|
|
625
|
-
const jobIdMap = buildJobIdMap
|
|
647
|
+
const jobIdMap = buildJobIdMap(reachableSteps);
|
|
626
648
|
let triggers = lowerTriggers$1(pipeline.entries, pipeline.inputs);
|
|
627
649
|
if (isCalled) triggers = addWorkflowCall(triggers, pipeline.inputs);
|
|
628
650
|
const jobs = lowerStepsWithCalls(reachableSteps, jobIdMap, pipeline.id, config);
|
|
@@ -696,26 +718,6 @@ function enqueueIfNew(id, reachable, queue) {
|
|
|
696
718
|
}
|
|
697
719
|
}
|
|
698
720
|
/**
|
|
699
|
-
* Build a mapping from full step IDs (e.g., "ci/lint") to GitHub-safe
|
|
700
|
-
* job IDs (e.g., "lint"). If there are collisions, append a suffix.
|
|
701
|
-
*/
|
|
702
|
-
function buildJobIdMap$1(steps) {
|
|
703
|
-
const map = /* @__PURE__ */ new Map();
|
|
704
|
-
const used = /* @__PURE__ */ new Set();
|
|
705
|
-
for (const step of steps) {
|
|
706
|
-
const shortId = step.id.includes("/") ? step.id.split("/").pop() : step.id;
|
|
707
|
-
let jobId = shortId;
|
|
708
|
-
let suffix = 1;
|
|
709
|
-
while (used.has(jobId)) {
|
|
710
|
-
jobId = `${shortId}-${suffix}`;
|
|
711
|
-
suffix++;
|
|
712
|
-
}
|
|
713
|
-
used.add(jobId);
|
|
714
|
-
map.set(step.id, jobId);
|
|
715
|
-
}
|
|
716
|
-
return map;
|
|
717
|
-
}
|
|
718
|
-
/**
|
|
719
721
|
* Map Sverka triggers to GitHub triggers.
|
|
720
722
|
* Multiple entries of the same kind have their filters merged.
|
|
721
723
|
*/
|
|
@@ -1255,7 +1257,7 @@ function lowerOperations$1(step, jobIdMap, config) {
|
|
|
1255
1257
|
for (const name of stdoutUploadNames) steps.push({
|
|
1256
1258
|
name: `Upload ${name}`,
|
|
1257
1259
|
if: "always()",
|
|
1258
|
-
uses: "actions/upload-artifact@
|
|
1260
|
+
uses: "actions/upload-artifact@v7",
|
|
1259
1261
|
with: {
|
|
1260
1262
|
name: artifactName(shortStepId, name),
|
|
1261
1263
|
path: step.runtime.workingDir ? `${step.runtime.workingDir}/${name}` : name
|
|
@@ -1311,7 +1313,7 @@ function lowerOperation$1(op, shortStepId, steps, runLines, flushRun) {
|
|
|
1311
1313
|
flushRun();
|
|
1312
1314
|
steps.push({
|
|
1313
1315
|
name: `Upload ${op.name}`,
|
|
1314
|
-
uses: "actions/upload-artifact@
|
|
1316
|
+
uses: "actions/upload-artifact@v7",
|
|
1315
1317
|
with: {
|
|
1316
1318
|
name: artifactName(shortStepId, op.name),
|
|
1317
1319
|
path: op.path,
|
|
@@ -1377,7 +1379,7 @@ function lowerImportArtifact(op, steps, flushRun) {
|
|
|
1377
1379
|
const fromShort = op.from.includes("/") ? op.from.split("/").pop() : op.from;
|
|
1378
1380
|
steps.push({
|
|
1379
1381
|
name: `Download ${op.output}`,
|
|
1380
|
-
uses: "actions/download-artifact@
|
|
1382
|
+
uses: "actions/download-artifact@v8",
|
|
1381
1383
|
with: {
|
|
1382
1384
|
name: artifactName(fromShort, op.output),
|
|
1383
1385
|
path: op.output
|
|
@@ -1436,7 +1438,7 @@ function lowerReport$1(spec) {
|
|
|
1436
1438
|
};
|
|
1437
1439
|
default: return {
|
|
1438
1440
|
name: `Upload ${spec.type} report`,
|
|
1439
|
-
uses: "actions/upload-artifact@
|
|
1441
|
+
uses: "actions/upload-artifact@v7",
|
|
1440
1442
|
with: {
|
|
1441
1443
|
name: `${spec.type}-report`,
|
|
1442
1444
|
path: spec.path
|
|
@@ -1709,7 +1711,10 @@ var pinned_actions_default = {
|
|
|
1709
1711
|
"actions/upload-pages-artifact@v3": "56afc609e74202658d3ffba0e8f6dda462b719fa",
|
|
1710
1712
|
"actions/deploy-pages@v4": "d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e",
|
|
1711
1713
|
"dorny/test-reporter@v1": "3eeb9fc888e82e8be2fb356bbeec2750231672bc",
|
|
1712
|
-
"github/codeql-action/upload-sarif@v3": "6f5948dfacef28e207b48d0905cf90c03365536d"
|
|
1714
|
+
"github/codeql-action/upload-sarif@v3": "6f5948dfacef28e207b48d0905cf90c03365536d",
|
|
1715
|
+
"actions/upload-artifact@v7": "043fb46d1a93c77aae656e7c1c64a875d1fc6a0a",
|
|
1716
|
+
"actions/download-artifact@v8": "3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c",
|
|
1717
|
+
"actions/setup-node@v7": "820762786026740c76f36085b0efc47a31fe5020"
|
|
1713
1718
|
};
|
|
1714
1719
|
//#endregion
|
|
1715
1720
|
//#region src/github/pinning.ts
|
|
@@ -2140,25 +2145,6 @@ function buildJobRulesMap(pipeline, reachableSteps, jobIdMap) {
|
|
|
2140
2145
|
return map;
|
|
2141
2146
|
}
|
|
2142
2147
|
/**
|
|
2143
|
-
* Build a mapping from full step IDs to GitLab-safe job IDs.
|
|
2144
|
-
*/
|
|
2145
|
-
function buildJobIdMap(steps) {
|
|
2146
|
-
const map = /* @__PURE__ */ new Map();
|
|
2147
|
-
const used = /* @__PURE__ */ new Set();
|
|
2148
|
-
for (const step of steps) {
|
|
2149
|
-
const shortId = step.id.includes("/") ? step.id.split("/").pop() : step.id;
|
|
2150
|
-
let jobId = shortId;
|
|
2151
|
-
let suffix = 1;
|
|
2152
|
-
while (used.has(jobId)) {
|
|
2153
|
-
jobId = `${shortId}-${suffix}`;
|
|
2154
|
-
suffix++;
|
|
2155
|
-
}
|
|
2156
|
-
used.add(jobId);
|
|
2157
|
-
map.set(step.id, jobId);
|
|
2158
|
-
}
|
|
2159
|
-
return map;
|
|
2160
|
-
}
|
|
2161
|
-
/**
|
|
2162
2148
|
* Compute stages by topological level.
|
|
2163
2149
|
* Level 0 → "build", Level N → "stage-N".
|
|
2164
2150
|
* Returns stages in dependency order (build first, then stage-1, etc.).
|