@nowline/embed 0.10.0 → 0.12.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/dist/meta.json +62 -23
- package/dist/nowline.esm.js +248 -59
- package/dist/nowline.esm.js.map +4 -4
- package/dist/nowline.min.js +59 -59
- package/dist/nowline.min.js.map +4 -4
- package/package.json +6 -6
package/dist/nowline.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @nowline/embed 0.
|
|
1
|
+
/*! @nowline/embed 0.12.0 sha=8ca0469 built=2026-11-04T02:39:24Z */
|
|
2
2
|
var __create = Object.create;
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -15082,7 +15082,7 @@ var UriUtils;
|
|
|
15082
15082
|
return a?.toString() === b?.toString();
|
|
15083
15083
|
}
|
|
15084
15084
|
UriUtils2.equals = equals;
|
|
15085
|
-
function
|
|
15085
|
+
function relative2(from, to) {
|
|
15086
15086
|
const fromPath = typeof from === "string" ? URI.parse(from).path : from.path;
|
|
15087
15087
|
const toPath = typeof to === "string" ? URI.parse(to).path : to.path;
|
|
15088
15088
|
const fromParts = fromPath.split("/").filter((e) => e.length > 0);
|
|
@@ -15109,7 +15109,7 @@ var UriUtils;
|
|
|
15109
15109
|
const toPart = toParts.slice(i2).join("/");
|
|
15110
15110
|
return backPart + toPart;
|
|
15111
15111
|
}
|
|
15112
|
-
UriUtils2.relative =
|
|
15112
|
+
UriUtils2.relative = relative2;
|
|
15113
15113
|
function normalize3(uri) {
|
|
15114
15114
|
return URI.parse(uri.toString()).toString();
|
|
15115
15115
|
}
|
|
@@ -23468,6 +23468,20 @@ function extractSuggestion(message) {
|
|
|
23468
23468
|
const match = message.match(DID_YOU_MEAN_RE);
|
|
23469
23469
|
return match ? match[1].trim() : void 0;
|
|
23470
23470
|
}
|
|
23471
|
+
var SUGGESTION_FROM_ARGS = {
|
|
23472
|
+
"NL.W0700": (a) => a.suggested || void 0,
|
|
23473
|
+
"NL.E1101": (a) => "suggestion" in a ? a.suggestion?.id : void 0
|
|
23474
|
+
};
|
|
23475
|
+
function suggestionFromArgs(code, args) {
|
|
23476
|
+
const pick = SUGGESTION_FROM_ARGS[code];
|
|
23477
|
+
return pick?.(...args);
|
|
23478
|
+
}
|
|
23479
|
+
function resolveDiagnosticSuggestion(message, data) {
|
|
23480
|
+
const code = stableValidatorCode(data);
|
|
23481
|
+
if (code === void 0)
|
|
23482
|
+
return extractSuggestion(message);
|
|
23483
|
+
return suggestionFromArgs(code, data.args);
|
|
23484
|
+
}
|
|
23471
23485
|
function inferCodeFromMessage(message) {
|
|
23472
23486
|
const lower = message.toLowerCase();
|
|
23473
23487
|
if (lower.includes("duplicate identifier"))
|
|
@@ -26425,6 +26439,44 @@ var messages = {
|
|
|
26425
26439
|
return `Wave "${a.id}" in "${a.path}" ${floorClause(a.childFloor)}, but this file's wave "${a.id}" ${floorClause(a.parentFloor)}. A wave must have the same start floor in every included roadmap.`;
|
|
26426
26440
|
}
|
|
26427
26441
|
},
|
|
26442
|
+
"NL.E0203": (a) => {
|
|
26443
|
+
switch (a.reason) {
|
|
26444
|
+
case "not-found":
|
|
26445
|
+
return `Cannot read include "${a.path}": file not found.`;
|
|
26446
|
+
case "is-directory":
|
|
26447
|
+
return `Cannot read include "${a.path}": it is a directory.`;
|
|
26448
|
+
case "permission-denied":
|
|
26449
|
+
return `Cannot read include "${a.path}": permission denied.`;
|
|
26450
|
+
case "not-nowline":
|
|
26451
|
+
return `Cannot read include "${a.path}": only .nowline files can be included.`;
|
|
26452
|
+
case "unreadable":
|
|
26453
|
+
return a.detail ? `Cannot read include "${a.path}": ${a.detail}` : `Cannot read include "${a.path}".`;
|
|
26454
|
+
}
|
|
26455
|
+
},
|
|
26456
|
+
"NL.E0204": (a) => `Circular include: "${a.path}" is already being included (${a.chain}).`,
|
|
26457
|
+
"NL.E0205": (a) => `Duplicate include "${a.path}". Include each file once.`,
|
|
26458
|
+
"NL.E0206": (a) => `Cannot isolate "${a.path}": it has no roadmap declaration.`,
|
|
26459
|
+
"NL.E0207": (a) => {
|
|
26460
|
+
if (a.parentStart && a.childStart) {
|
|
26461
|
+
return `Included "${a.path}" declares start:${a.childStart}, which doesn't match this file's start:${a.parentStart}. Both files must declare the same start date, or neither should.`;
|
|
26462
|
+
}
|
|
26463
|
+
if (a.parentStart) {
|
|
26464
|
+
return `Included "${a.path}" has no start:, but this file declares start:${a.parentStart}. Both files must declare the same start date, or neither should.`;
|
|
26465
|
+
}
|
|
26466
|
+
return `Included "${a.path}" declares start:${a.childStart}, but this file has no start:. Both files must declare the same start date, or neither should.`;
|
|
26467
|
+
},
|
|
26468
|
+
"NL.E0208": (a) => {
|
|
26469
|
+
switch (a.reason) {
|
|
26470
|
+
case "absolute":
|
|
26471
|
+
return `Include "${a.path}" is an absolute path. With an include root, an include must be a relative path inside it.`;
|
|
26472
|
+
case "parent":
|
|
26473
|
+
return `Include "${a.path}" resolves outside the include root.`;
|
|
26474
|
+
case "symlink":
|
|
26475
|
+
return `Include "${a.path}" resolves outside the include root through a symbolic link.`;
|
|
26476
|
+
}
|
|
26477
|
+
},
|
|
26478
|
+
"NL.E0209": (a) => `Includes are not supported in this context: "${a.path}" was not read.`,
|
|
26479
|
+
"NL.E0210": (a) => `Include "${a.path}" is more than ${a.max} includes deep. Flatten the include chain.`,
|
|
26428
26480
|
// Identifier
|
|
26429
26481
|
"NL.E0300": (a) => `Duplicate identifier "${a.name}". First declared at ${a.location}.`,
|
|
26430
26482
|
"NL.E0301": (a) => `${a.type} must have an identifier, a title, or both.`,
|
|
@@ -26687,6 +26739,44 @@ var messages2 = {
|
|
|
26687
26739
|
return `La vague ${q(a.id)} dans ${q(a.path)} ${floorText(a.childFloor)}, mais la vague ${q(a.id)} de ce fichier ${floorText(a.parentFloor)}. Une vague doit avoir la m\xEAme borne de d\xE9part dans chaque roadmap incluse.`;
|
|
26688
26740
|
}
|
|
26689
26741
|
},
|
|
26742
|
+
"NL.E0203": (a) => {
|
|
26743
|
+
switch (a.reason) {
|
|
26744
|
+
case "not-found":
|
|
26745
|
+
return `Impossible de lire l'include ${q(a.path)}\xA0: fichier introuvable.`;
|
|
26746
|
+
case "is-directory":
|
|
26747
|
+
return `Impossible de lire l'include ${q(a.path)}\xA0: c'est un r\xE9pertoire.`;
|
|
26748
|
+
case "permission-denied":
|
|
26749
|
+
return `Impossible de lire l'include ${q(a.path)}\xA0: permission refus\xE9e.`;
|
|
26750
|
+
case "not-nowline":
|
|
26751
|
+
return `Impossible de lire l'include ${q(a.path)}\xA0: seuls les fichiers .nowline peuvent \xEAtre inclus.`;
|
|
26752
|
+
case "unreadable":
|
|
26753
|
+
return a.detail ? `Impossible de lire l'include ${q(a.path)}\xA0: ${a.detail}` : `Impossible de lire l'include ${q(a.path)}.`;
|
|
26754
|
+
}
|
|
26755
|
+
},
|
|
26756
|
+
"NL.E0204": (a) => `Include circulaire\xA0: ${q(a.path)} est d\xE9j\xE0 en cours d'inclusion (${a.chain}).`,
|
|
26757
|
+
"NL.E0205": (a) => `Include ${q(a.path)} en double. Incluez chaque fichier une seule fois.`,
|
|
26758
|
+
"NL.E0206": (a) => `Impossible d'isoler ${q(a.path)}\xA0: il ne d\xE9clare aucune roadmap.`,
|
|
26759
|
+
"NL.E0207": (a) => {
|
|
26760
|
+
if (a.parentStart && a.childStart) {
|
|
26761
|
+
return `L'include ${q(a.path)} d\xE9clare start:${a.childStart}, qui ne correspond pas au start:${a.parentStart} de ce fichier. Les deux fichiers doivent d\xE9clarer la m\xEAme date de d\xE9but, ou aucun des deux.`;
|
|
26762
|
+
}
|
|
26763
|
+
if (a.parentStart) {
|
|
26764
|
+
return `L'include ${q(a.path)} n'a pas de start:, mais ce fichier d\xE9clare start:${a.parentStart}. Les deux fichiers doivent d\xE9clarer la m\xEAme date de d\xE9but, ou aucun des deux.`;
|
|
26765
|
+
}
|
|
26766
|
+
return `L'include ${q(a.path)} d\xE9clare start:${a.childStart}, mais ce fichier n'a pas de start:. Les deux fichiers doivent d\xE9clarer la m\xEAme date de d\xE9but, ou aucun des deux.`;
|
|
26767
|
+
},
|
|
26768
|
+
"NL.E0208": (a) => {
|
|
26769
|
+
switch (a.reason) {
|
|
26770
|
+
case "absolute":
|
|
26771
|
+
return `L'include ${q(a.path)} est un chemin absolu. Avec une racine d'include, un include doit \xEAtre un chemin relatif \xE0 l'int\xE9rieur de celle-ci.`;
|
|
26772
|
+
case "parent":
|
|
26773
|
+
return `L'include ${q(a.path)} se r\xE9sout hors de la racine d'include.`;
|
|
26774
|
+
case "symlink":
|
|
26775
|
+
return `L'include ${q(a.path)} se r\xE9sout hors de la racine d'include par un lien symbolique.`;
|
|
26776
|
+
}
|
|
26777
|
+
},
|
|
26778
|
+
"NL.E0209": (a) => `Les includes ne sont pas pris en charge dans ce contexte\xA0: ${q(a.path)} n'a pas \xE9t\xE9 lu.`,
|
|
26779
|
+
"NL.E0210": (a) => `L'include ${q(a.path)} d\xE9passe ${a.max} niveaux d'inclusion. Aplatissez la cha\xEEne d'includes.`,
|
|
26690
26780
|
// Identifiant
|
|
26691
26781
|
"NL.E0300": (a) => `Identifiant en double \xAB\xA0${a.name}\xA0\xBB. Premi\xE8re d\xE9claration \xE0 ${a.location}.`,
|
|
26692
26782
|
"NL.E0301": (a) => `${a.type} doit comporter un identifiant, un titre, ou les deux.`,
|
|
@@ -26942,6 +27032,27 @@ function normalize2(p, sep) {
|
|
|
26942
27032
|
}
|
|
26943
27033
|
return prefix + segments.join(sep);
|
|
26944
27034
|
}
|
|
27035
|
+
function segmentsOf(p) {
|
|
27036
|
+
const normalized = resolve("", p).replace(/\\/g, "/");
|
|
27037
|
+
const drive = /^[A-Za-z]:/.test(normalized) ? normalized.slice(0, 2).toLowerCase() : "";
|
|
27038
|
+
const body = drive ? normalized.slice(2) : normalized;
|
|
27039
|
+
return [drive, ...body.split("/").filter((s) => s !== "")];
|
|
27040
|
+
}
|
|
27041
|
+
function isWithin(dir, p) {
|
|
27042
|
+
const d = segmentsOf(dir);
|
|
27043
|
+
const t = segmentsOf(p);
|
|
27044
|
+
return d.length <= t.length && d.every((seg, i2) => seg === t[i2]);
|
|
27045
|
+
}
|
|
27046
|
+
function relative(from, to) {
|
|
27047
|
+
const f = segmentsOf(from);
|
|
27048
|
+
const t = segmentsOf(to);
|
|
27049
|
+
if (f[0] !== t[0])
|
|
27050
|
+
return to;
|
|
27051
|
+
let i2 = 0;
|
|
27052
|
+
while (i2 < f.length && i2 < t.length && f[i2] === t[i2])
|
|
27053
|
+
i2++;
|
|
27054
|
+
return [...f.slice(i2).map(() => ".."), ...t.slice(i2)].join("/") || ".";
|
|
27055
|
+
}
|
|
26945
27056
|
|
|
26946
27057
|
// ../core/dist/util/single-line.js
|
|
26947
27058
|
function singleLine(text) {
|
|
@@ -28158,8 +28269,8 @@ function hasParseErrors(file) {
|
|
|
28158
28269
|
const result = file.$document?.parseResult;
|
|
28159
28270
|
return !!result && (result.lexerErrors.length > 0 || result.parserErrors.length > 0);
|
|
28160
28271
|
}
|
|
28161
|
-
function participates(childFile, childContent
|
|
28162
|
-
if (
|
|
28272
|
+
function participates(childFile, childContent) {
|
|
28273
|
+
if (hasParseErrors(childFile))
|
|
28163
28274
|
return false;
|
|
28164
28275
|
return !!childFile.roadmapDecl || childContent.swimlanes.size > 0 || ownWaves(childFile).length > 0;
|
|
28165
28276
|
}
|
|
@@ -28457,6 +28568,34 @@ function checkIncludedReferences(rootAbs, edges) {
|
|
|
28457
28568
|
return out;
|
|
28458
28569
|
}
|
|
28459
28570
|
|
|
28571
|
+
// ../core/dist/language/include-swimlanes.js
|
|
28572
|
+
function swimlaneRuleNeedsIncludes(file) {
|
|
28573
|
+
return file.includes.some((inc) => inc.options.find((o) => o.key === "roadmap")?.value !== "ignore");
|
|
28574
|
+
}
|
|
28575
|
+
function rendersSwimlane(content) {
|
|
28576
|
+
return content.swimlanes.size > 0 || content.isolatedRegions.some((r) => rendersSwimlane(r.content));
|
|
28577
|
+
}
|
|
28578
|
+
function checkMergedSwimlanes(rootFile, rootAbs, rootContent, diagnostics) {
|
|
28579
|
+
const roadmap = rootFile.roadmapDecl;
|
|
28580
|
+
if (!roadmap || !swimlaneRuleNeedsIncludes(rootFile))
|
|
28581
|
+
return [];
|
|
28582
|
+
if (diagnostics.some((d) => d.severity === "error"))
|
|
28583
|
+
return [];
|
|
28584
|
+
if (rendersSwimlane(rootContent))
|
|
28585
|
+
return [];
|
|
28586
|
+
return [
|
|
28587
|
+
{
|
|
28588
|
+
severity: "error",
|
|
28589
|
+
message: tr("en-US", "NL.E0004"),
|
|
28590
|
+
sourcePath: rootAbs,
|
|
28591
|
+
// The validator reports NL.E0004 on the whole declaration.
|
|
28592
|
+
...nodeLocation(roadmap),
|
|
28593
|
+
code: "NL.E0004",
|
|
28594
|
+
args: []
|
|
28595
|
+
}
|
|
28596
|
+
];
|
|
28597
|
+
}
|
|
28598
|
+
|
|
28460
28599
|
// ../core/dist/language/include-resolver.js
|
|
28461
28600
|
function readStartProp(decl) {
|
|
28462
28601
|
const prop = decl?.properties.find((p) => p.key === "start");
|
|
@@ -28464,15 +28603,6 @@ function readStartProp(decl) {
|
|
|
28464
28603
|
return void 0;
|
|
28465
28604
|
return prop.value;
|
|
28466
28605
|
}
|
|
28467
|
-
function formatStartMismatch(childRelPath, parentStart, childStart) {
|
|
28468
|
-
if (parentStart && childStart) {
|
|
28469
|
-
return `Included "${childRelPath}" declares start:${childStart}, which doesn't match this file's start:${parentStart}. Both files must declare the same start date, or neither should.`;
|
|
28470
|
-
}
|
|
28471
|
-
if (parentStart) {
|
|
28472
|
-
return `Included "${childRelPath}" has no start:, but this file declares start:${parentStart}. Both files must declare the same start date, or neither should.`;
|
|
28473
|
-
}
|
|
28474
|
-
return `Included "${childRelPath}" declares start:${childStart}, but this file has no start:. Both files must declare the same start date, or neither should.`;
|
|
28475
|
-
}
|
|
28476
28606
|
function isRoutedResolveDiagnostic(d) {
|
|
28477
28607
|
return d.code !== void 0 || d.rule === "wave" || d.syntax !== void 0;
|
|
28478
28608
|
}
|
|
@@ -28498,22 +28628,30 @@ function emptyContent() {
|
|
|
28498
28628
|
isolatedRegions: []
|
|
28499
28629
|
};
|
|
28500
28630
|
}
|
|
28631
|
+
var MAX_INCLUDE_DEPTH = 16;
|
|
28501
28632
|
async function resolveIncludes(file, filePath, options) {
|
|
28502
28633
|
const readFile = options.readFile ?? (async (p) => {
|
|
28503
28634
|
const { nodeReadFile: nodeReadFile2 } = await Promise.resolve().then(() => (init_node_read_file(), node_read_file_exports));
|
|
28504
28635
|
return nodeReadFile2(p);
|
|
28505
28636
|
});
|
|
28637
|
+
const policy = options.includePolicy;
|
|
28638
|
+
const realPath = (policy?.kind === "rooted" ? policy.realPath : void 0) ?? (async (p) => {
|
|
28639
|
+
const { nodeRealPath } = await Promise.resolve().then(() => (init_node_read_file(), node_read_file_exports));
|
|
28640
|
+
return nodeRealPath(p);
|
|
28641
|
+
});
|
|
28506
28642
|
const absPath = resolve("", filePath);
|
|
28507
28643
|
const ctx = {
|
|
28508
28644
|
services: options.services,
|
|
28509
28645
|
rootAbs: absPath,
|
|
28646
|
+
policy,
|
|
28647
|
+
realPath,
|
|
28648
|
+
displayBase: policy?.kind === "rooted" ? policy.root : dirname(absPath),
|
|
28510
28649
|
diagnostics: [],
|
|
28511
28650
|
resolving: [],
|
|
28512
28651
|
processed: /* @__PURE__ */ new Map(),
|
|
28513
28652
|
readFile,
|
|
28514
28653
|
files: /* @__PURE__ */ new Map(),
|
|
28515
28654
|
edges: /* @__PURE__ */ new Map(),
|
|
28516
|
-
stubs: /* @__PURE__ */ new Set(),
|
|
28517
28655
|
failedWaves: /* @__PURE__ */ new Set()
|
|
28518
28656
|
};
|
|
28519
28657
|
const { config: config2, content } = await resolveFile(file, absPath, ctx);
|
|
@@ -28526,6 +28664,7 @@ async function resolveIncludes(file, filePath, options) {
|
|
|
28526
28664
|
failed: ctx.failedWaves
|
|
28527
28665
|
}));
|
|
28528
28666
|
ctx.diagnostics.push(...checkIncludedReferences(absPath, ctx.edges));
|
|
28667
|
+
ctx.diagnostics.push(...checkMergedSwimlanes(file, absPath, content, ctx.diagnostics));
|
|
28529
28668
|
return {
|
|
28530
28669
|
config: config2,
|
|
28531
28670
|
content,
|
|
@@ -28537,17 +28676,6 @@ async function resolveFile(file, absPath, ctx) {
|
|
|
28537
28676
|
if (ctx.processed.has(absPath)) {
|
|
28538
28677
|
return ctx.processed.get(absPath);
|
|
28539
28678
|
}
|
|
28540
|
-
if (ctx.resolving.includes(absPath)) {
|
|
28541
|
-
ctx.diagnostics.push({
|
|
28542
|
-
severity: "error",
|
|
28543
|
-
message: `Circular include detected: ${[...ctx.resolving, absPath].join(" \u2192 ")}`,
|
|
28544
|
-
sourcePath: absPath
|
|
28545
|
-
});
|
|
28546
|
-
const empty = { config: emptyConfig(), content: emptyContent() };
|
|
28547
|
-
ctx.stubs.add(empty.content);
|
|
28548
|
-
ctx.processed.set(absPath, empty);
|
|
28549
|
-
return empty;
|
|
28550
|
-
}
|
|
28551
28679
|
if (absPath !== ctx.rootAbs)
|
|
28552
28680
|
ctx.diagnostics.push(...syntaxDiagnostics(file, absPath));
|
|
28553
28681
|
ctx.resolving.push(absPath);
|
|
@@ -28565,17 +28693,42 @@ async function resolveFile(file, absPath, ctx) {
|
|
|
28565
28693
|
const seenIncludes = /* @__PURE__ */ new Set();
|
|
28566
28694
|
for (const inc of file.includes) {
|
|
28567
28695
|
const childRelPath = inc.path;
|
|
28568
|
-
const
|
|
28696
|
+
const fail = (code, ...args) => {
|
|
28697
|
+
ctx.diagnostics.push(includeError(absPath, inc, code, ...args));
|
|
28698
|
+
};
|
|
28699
|
+
if (ctx.policy?.kind === "disabled") {
|
|
28700
|
+
fail("NL.E0209", { path: childRelPath });
|
|
28701
|
+
continue;
|
|
28702
|
+
}
|
|
28703
|
+
const located = await locateInclude(absPath, childRelPath, ctx);
|
|
28704
|
+
if ("refused" in located) {
|
|
28705
|
+
fail("NL.E0208", located.refused);
|
|
28706
|
+
continue;
|
|
28707
|
+
}
|
|
28708
|
+
if ("unreadable" in located) {
|
|
28709
|
+
fail("NL.E0203", located.unreadable);
|
|
28710
|
+
continue;
|
|
28711
|
+
}
|
|
28712
|
+
const childAbsPath = located.absPath;
|
|
28569
28713
|
if (seenIncludes.has(childAbsPath)) {
|
|
28570
|
-
|
|
28571
|
-
severity: "error",
|
|
28572
|
-
message: `Duplicate include "${childRelPath}" in ${basename(absPath)}.`,
|
|
28573
|
-
sourcePath: absPath,
|
|
28574
|
-
line: inc.$cstNode?.range.start.line
|
|
28575
|
-
});
|
|
28714
|
+
fail("NL.E0205", { path: childRelPath });
|
|
28576
28715
|
continue;
|
|
28577
28716
|
}
|
|
28578
28717
|
seenIncludes.add(childAbsPath);
|
|
28718
|
+
const cycleStart = ctx.resolving.indexOf(childAbsPath);
|
|
28719
|
+
if (cycleStart >= 0) {
|
|
28720
|
+
const chain = [...ctx.resolving.slice(cycleStart), childAbsPath].map((p) => relative(ctx.displayBase, p)).join(" \u2192 ");
|
|
28721
|
+
fail("NL.E0204", { path: childRelPath, chain });
|
|
28722
|
+
continue;
|
|
28723
|
+
}
|
|
28724
|
+
if (ctx.resolving.length > MAX_INCLUDE_DEPTH) {
|
|
28725
|
+
fail("NL.E0210", { path: childRelPath, max: MAX_INCLUDE_DEPTH });
|
|
28726
|
+
continue;
|
|
28727
|
+
}
|
|
28728
|
+
if (!childAbsPath.endsWith(".nowline")) {
|
|
28729
|
+
fail("NL.E0203", { reason: "not-nowline", path: childRelPath });
|
|
28730
|
+
continue;
|
|
28731
|
+
}
|
|
28579
28732
|
const configMode = getIncludeMode(inc, "config") ?? "merge";
|
|
28580
28733
|
const roadmapMode = getIncludeMode(inc, "roadmap") ?? "merge";
|
|
28581
28734
|
let childFile;
|
|
@@ -28583,12 +28736,7 @@ async function resolveFile(file, absPath, ctx) {
|
|
|
28583
28736
|
const text = await ctx.readFile(childAbsPath);
|
|
28584
28737
|
childFile = await parseString(ctx.services, text, childAbsPath);
|
|
28585
28738
|
} catch (err) {
|
|
28586
|
-
|
|
28587
|
-
severity: "error",
|
|
28588
|
-
message: `Could not read include "${childRelPath}": ${err.message}`,
|
|
28589
|
-
sourcePath: absPath,
|
|
28590
|
-
line: inc.$cstNode?.range.start.line
|
|
28591
|
-
});
|
|
28739
|
+
fail("NL.E0203", unreadableArgs(childRelPath, err));
|
|
28592
28740
|
continue;
|
|
28593
28741
|
}
|
|
28594
28742
|
const { config: childConfig, content: childContent } = await resolveFile(childFile, childAbsPath, ctx);
|
|
@@ -28600,28 +28748,22 @@ async function resolveFile(file, absPath, ctx) {
|
|
|
28600
28748
|
mode: roadmapMode,
|
|
28601
28749
|
childFile,
|
|
28602
28750
|
childContent,
|
|
28603
|
-
participates: participates(childFile, childContent
|
|
28751
|
+
participates: participates(childFile, childContent)
|
|
28604
28752
|
});
|
|
28605
28753
|
applyConfigMode(config2, childConfig, configMode, childAbsPath, ctx.diagnostics);
|
|
28606
28754
|
applyRoadmapMode(content, childContent, childConfig, roadmapMode, childAbsPath, childRelPath, ctx.diagnostics);
|
|
28607
28755
|
const isParsed = !hasParseErrors(childFile);
|
|
28608
28756
|
if (isParsed && roadmapMode === "isolate" && !childContent.roadmap) {
|
|
28609
|
-
|
|
28610
|
-
severity: "error",
|
|
28611
|
-
message: `Cannot isolate "${childRelPath}": it has no roadmap declaration.`,
|
|
28612
|
-
sourcePath: absPath,
|
|
28613
|
-
line: inc.$cstNode?.range.start.line
|
|
28614
|
-
});
|
|
28757
|
+
fail("NL.E0206", { path: childRelPath });
|
|
28615
28758
|
}
|
|
28616
28759
|
if (isParsed && roadmapMode !== "ignore" && childFile.roadmapDecl) {
|
|
28617
28760
|
const parentStart = readStartProp(file.roadmapDecl);
|
|
28618
28761
|
const childStart = readStartProp(childFile.roadmapDecl);
|
|
28619
28762
|
if (parentStart !== childStart) {
|
|
28620
|
-
|
|
28621
|
-
|
|
28622
|
-
|
|
28623
|
-
|
|
28624
|
-
line: inc.$cstNode?.range.start.line
|
|
28763
|
+
fail("NL.E0207", {
|
|
28764
|
+
path: childRelPath,
|
|
28765
|
+
...parentStart ? { parentStart } : {},
|
|
28766
|
+
...childStart ? { childStart } : {}
|
|
28625
28767
|
});
|
|
28626
28768
|
}
|
|
28627
28769
|
}
|
|
@@ -28639,6 +28781,49 @@ async function resolveFile(file, absPath, ctx) {
|
|
|
28639
28781
|
ctx.processed.set(absPath, result);
|
|
28640
28782
|
return result;
|
|
28641
28783
|
}
|
|
28784
|
+
function includeError(sourcePath, inc, code, ...args) {
|
|
28785
|
+
return {
|
|
28786
|
+
severity: "error",
|
|
28787
|
+
message: tr("en-US", code, ...args),
|
|
28788
|
+
sourcePath,
|
|
28789
|
+
...nodeLocation(inc, "path"),
|
|
28790
|
+
code,
|
|
28791
|
+
args
|
|
28792
|
+
};
|
|
28793
|
+
}
|
|
28794
|
+
async function locateInclude(parentAbs, path, ctx) {
|
|
28795
|
+
const policy = ctx.policy;
|
|
28796
|
+
if (policy?.kind !== "rooted")
|
|
28797
|
+
return { absPath: resolve(dirname(parentAbs), path) };
|
|
28798
|
+
if (isAbsolute(path))
|
|
28799
|
+
return { refused: { reason: "absolute", path } };
|
|
28800
|
+
const lexical = resolve(dirname(parentAbs), path);
|
|
28801
|
+
if (!isWithin(policy.root, lexical))
|
|
28802
|
+
return { refused: { reason: "parent", path } };
|
|
28803
|
+
let real;
|
|
28804
|
+
try {
|
|
28805
|
+
real = await ctx.realPath(lexical);
|
|
28806
|
+
} catch (err) {
|
|
28807
|
+
return { unreadable: unreadableArgs(path, err) };
|
|
28808
|
+
}
|
|
28809
|
+
if (!isWithin(policy.root, real))
|
|
28810
|
+
return { refused: { reason: "symlink", path } };
|
|
28811
|
+
return { absPath: real };
|
|
28812
|
+
}
|
|
28813
|
+
function unreadableArgs(path, err) {
|
|
28814
|
+
switch (err?.code) {
|
|
28815
|
+
case "ENOENT":
|
|
28816
|
+
case "ENOTDIR":
|
|
28817
|
+
return { reason: "not-found", path };
|
|
28818
|
+
case "EISDIR":
|
|
28819
|
+
return { reason: "is-directory", path };
|
|
28820
|
+
case "EACCES":
|
|
28821
|
+
case "EPERM":
|
|
28822
|
+
return { reason: "permission-denied", path };
|
|
28823
|
+
}
|
|
28824
|
+
const detail = err instanceof Error ? err.message : void 0;
|
|
28825
|
+
return { reason: "unreadable", path, ...detail ? { detail } : {} };
|
|
28826
|
+
}
|
|
28642
28827
|
function syntaxDiagnostics(file, absPath) {
|
|
28643
28828
|
const doc = file.$document;
|
|
28644
28829
|
if (!doc)
|
|
@@ -30030,6 +30215,8 @@ function checkIndentationConsistency(file, accept) {
|
|
|
30030
30215
|
}
|
|
30031
30216
|
}
|
|
30032
30217
|
function checkSwimlaneRequired(file, accept) {
|
|
30218
|
+
if (swimlaneRuleNeedsIncludes(file))
|
|
30219
|
+
return;
|
|
30033
30220
|
const hasSwimlane = file.roadmapEntries.some(isSwimlaneDeclaration);
|
|
30034
30221
|
if (file.roadmapDecl && !hasSwimlane) {
|
|
30035
30222
|
acceptTr(accept, "error", { node: file.roadmapDecl }, "NL.E0004");
|
|
@@ -33032,7 +33219,7 @@ function parseLinkIcon(link) {
|
|
|
33032
33219
|
}
|
|
33033
33220
|
function buildLabelChip(label, ctx, x2, y, maxWidth) {
|
|
33034
33221
|
const style = resolveLabelChipStyle(label, ctx);
|
|
33035
|
-
const text = label.
|
|
33222
|
+
const text = label.title ?? label.name ?? "";
|
|
33036
33223
|
const padKey = style.padding === "none" ? "xs" : style.padding;
|
|
33037
33224
|
const pad = PADDING_PX[padKey];
|
|
33038
33225
|
let width = Math.max(20, Math.round(text.length * 5.5 + pad * 2));
|
|
@@ -37275,7 +37462,7 @@ function fromLangiumDiagnostic(diag, file) {
|
|
|
37275
37462
|
// panel, then falls back to Langium's `code`, then a message heuristic.
|
|
37276
37463
|
code: resolveDiagnosticCode(diag),
|
|
37277
37464
|
message: diag.message,
|
|
37278
|
-
suggestion:
|
|
37465
|
+
suggestion: resolveDiagnosticSuggestion(diag.message, diag.data),
|
|
37279
37466
|
file,
|
|
37280
37467
|
line: (diag.range?.start.line ?? 0) + 1,
|
|
37281
37468
|
column: (diag.range?.start.character ?? 0) + 1
|
|
@@ -37320,7 +37507,7 @@ function fromResolveDiagnostic(diag, locale) {
|
|
|
37320
37507
|
};
|
|
37321
37508
|
}
|
|
37322
37509
|
const message = locale ? localizeResolveDiagnostic(locale, diag) : diag.message;
|
|
37323
|
-
const suggestion =
|
|
37510
|
+
const suggestion = resolveDiagnosticSuggestion(message, diag.code === void 0 ? void 0 : { code: diag.code, args: diag.args ?? [] });
|
|
37324
37511
|
return {
|
|
37325
37512
|
severity: diag.severity,
|
|
37326
37513
|
code: diag.code ?? inferCodeFromMessage(diag.message),
|
|
@@ -38071,11 +38258,13 @@ async function stageRoadmap(inputs) {
|
|
|
38071
38258
|
const ast = document2.parseResult.value;
|
|
38072
38259
|
const resolved = await resolveIncludes(ast, inputs.sourcePath, {
|
|
38073
38260
|
services: inputs.services.Nowline,
|
|
38074
|
-
readFile: inputs.readSource
|
|
38261
|
+
readFile: inputs.readSource,
|
|
38262
|
+
includePolicy: inputs.includePolicy
|
|
38075
38263
|
});
|
|
38076
38264
|
const isTolerated = inputs.isToleratedIncludeError ?? (() => false);
|
|
38077
|
-
const
|
|
38078
|
-
const
|
|
38265
|
+
const isCounted = (d) => d.severity !== "error" || !isTolerated(d);
|
|
38266
|
+
const errors = resolved.diagnostics.filter((d) => d.severity === "error" && isCounted(d));
|
|
38267
|
+
const routed = resolved.diagnostics.filter((d) => isRoutedResolveDiagnostic(d) && isCounted(d));
|
|
38079
38268
|
const legacy = errors.find((d) => !isRoutedResolveDiagnostic(d));
|
|
38080
38269
|
if (legacy) {
|
|
38081
38270
|
return { kind: "include-error", document: document2, legacy, routed: [], resolved };
|
|
@@ -40879,8 +41068,8 @@ function effectiveTheme(theme, systemTheme) {
|
|
|
40879
41068
|
}
|
|
40880
41069
|
|
|
40881
41070
|
// src/index.ts
|
|
40882
|
-
var version = true ? "0.
|
|
40883
|
-
var sha = true ? "
|
|
41071
|
+
var version = true ? "0.12.0" : "0.0.0";
|
|
41072
|
+
var sha = true ? "8ca0469" : "unknown";
|
|
40884
41073
|
var DEFAULT_SELECTOR = "pre code.language-nowline, code.language-nowline";
|
|
40885
41074
|
var initialConfig = {
|
|
40886
41075
|
theme: "auto",
|