@athrio/loom 0.0.6 → 0.0.8
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/{LoomServer-ew_Ofzfo.js → LoomServer-CxdKR04b.js} +2 -2
- package/dist/{LoomServer-ew_Ofzfo.js.map → LoomServer-CxdKR04b.js.map} +1 -1
- package/dist/{LoomStore-DOjrkJaQ.js → LoomStore-C2tWuEsJ.js} +86 -9
- package/dist/{LoomStore-DOjrkJaQ.js.map → LoomStore-C2tWuEsJ.js.map} +1 -1
- package/dist/main.js +3 -3
- package/dist/main.js.map +1 -1
- package/package.json +1 -1
|
@@ -148449,13 +148449,19 @@ var buildSection = (index, defaultLang, modulePath, pkg, variables) => (section)
|
|
|
148449
148449
|
};
|
|
148450
148450
|
};
|
|
148451
148451
|
var tangleFilePath = (pkg, sink) => pkg.endsWith("/") ? pkg + getOrElse$2(map$29(sink, (s) => s.file.value), () => "") : pkg;
|
|
148452
|
+
var filePath = (pkg, sink) => match$13(pkg, {
|
|
148453
|
+
onSome: (p) => some$13(tangleFilePath(p, sink)),
|
|
148454
|
+
onNone: () => map$29(sink, (s) => s.file.value)
|
|
148455
|
+
});
|
|
148452
148456
|
var tangleFile = (section, pkg, code) => {
|
|
148453
|
-
const
|
|
148454
|
-
|
|
148455
|
-
|
|
148457
|
+
const sink = fromNullishOr$4(section.heading.sink);
|
|
148458
|
+
return map$29(match$13(fromNullishOr$4(section.heading.specifier), {
|
|
148459
|
+
onNone: () => flatMap$13(sink, () => filePath(pkg, sink)),
|
|
148460
|
+
onSome: (spec) => value$1(spec.label.value.toLowerCase()).pipe(when("tangle", () => filePath(pkg, sink)), orElse(() => none$1()))
|
|
148461
|
+
}), (path) => FileSchema.make({
|
|
148462
|
+
path,
|
|
148456
148463
|
code
|
|
148457
148464
|
}));
|
|
148458
|
-
return none$1();
|
|
148459
148465
|
};
|
|
148460
148466
|
var buildCode = (section, values, index, origin, languageId) => {
|
|
148461
148467
|
const bind = bindAnchor(index, values, languageId, origin.path);
|
|
@@ -149141,13 +149147,15 @@ var VariablesSchema = Record$1(String$1, Union([
|
|
|
149141
149147
|
Number$1,
|
|
149142
149148
|
Boolean$2
|
|
149143
149149
|
]));
|
|
149150
|
+
var HeaderSchema = Struct({ ascii: optional(Boolean$2) });
|
|
149144
149151
|
var WorkspaceManifestSchema = Struct({
|
|
149145
149152
|
languages: optional(Record$1(String$1, LanguageSchema)),
|
|
149146
149153
|
corpus: optional(String$1),
|
|
149147
149154
|
primary: optional(String$1),
|
|
149148
149155
|
anchor: optional(AnchorSchema),
|
|
149149
149156
|
settings: optional(SettingsSchema),
|
|
149150
|
-
variables: optional(VariablesSchema)
|
|
149157
|
+
variables: optional(VariablesSchema),
|
|
149158
|
+
header: optional(HeaderSchema)
|
|
149151
149159
|
});
|
|
149152
149160
|
var empty = {
|
|
149153
149161
|
anchor: void 0,
|
|
@@ -149155,6 +149163,7 @@ var empty = {
|
|
|
149155
149163
|
languages: [],
|
|
149156
149164
|
settings: {},
|
|
149157
149165
|
variables: {},
|
|
149166
|
+
header: void 0,
|
|
149158
149167
|
services: {},
|
|
149159
149168
|
packageRoot: void 0,
|
|
149160
149169
|
workspaceRoot: void 0,
|
|
@@ -149200,6 +149209,7 @@ var resolveFromManifest = (manifest, workspace, fromPath) => {
|
|
|
149200
149209
|
languages: Object.keys(manifest.languages ?? {}),
|
|
149201
149210
|
settings: manifest.settings ?? {},
|
|
149202
149211
|
variables: variablesOf(manifest.variables),
|
|
149212
|
+
header: manifest.header === void 0 ? void 0 : { ascii: manifest.header.ascii ?? false },
|
|
149203
149213
|
services: servicesOf(manifest.languages),
|
|
149204
149214
|
packageRoot: containerRoot(dirname(fromPath), container, workspace),
|
|
149205
149215
|
workspaceRoot: workspace,
|
|
@@ -149240,6 +149250,7 @@ var PackageConfig = class extends Service$1()("PackageConfig", { make: gen$1(fun
|
|
|
149240
149250
|
delims: anchorDelimsOf(c.anchor),
|
|
149241
149251
|
primaryLanguage: c.primary,
|
|
149242
149252
|
variables: c.variables,
|
|
149253
|
+
header: c.header,
|
|
149243
149254
|
packageRoot: c.packageRoot,
|
|
149244
149255
|
workspaceRoot: c.workspaceRoot,
|
|
149245
149256
|
corpusDir: c.corpusDir
|
|
@@ -149621,12 +149632,12 @@ var outputPath = (packageRoot, entry, sink) => match$13(packageRoot, {
|
|
|
149621
149632
|
onNone: () => resolve(dirname(entry), sink),
|
|
149622
149633
|
onSome: (root) => resolve(root, sink)
|
|
149623
149634
|
});
|
|
149624
|
-
var resolveSinks = (modules, entry, packageRoot) => pipe(fromNullishOr$4(modules.get(entry)), match$13({
|
|
149635
|
+
var resolveSinks = (modules, entry, packageRoot, header) => pipe(fromNullishOr$4(modules.get(entry)), match$13({
|
|
149625
149636
|
onNone: () => [],
|
|
149626
149637
|
onSome: (module) => map$24(module.product.files, (file) => ({
|
|
149627
149638
|
section: file.code.origin.name,
|
|
149628
149639
|
path: outputPath(packageRoot, entry, file.path),
|
|
149629
|
-
content: fromProduct(modules, file.code.origin).code
|
|
149640
|
+
content: stamped(header, file.code.languageId, basename(entry), fromProduct(modules, file.code.origin).code)
|
|
149630
149641
|
}))
|
|
149631
149642
|
}));
|
|
149632
149643
|
var TangleError = class extends TaggedError("TangleError") {
|
|
@@ -149636,6 +149647,72 @@ var TangleError = class extends TaggedError("TangleError") {
|
|
|
149636
149647
|
return `loom: refusing to tangle ${this.entry} — ${count} error(s) across the corpus:\n${lines.join("\n")}`;
|
|
149637
149648
|
}
|
|
149638
149649
|
};
|
|
149650
|
+
var cStyle = {
|
|
149651
|
+
kind: "block",
|
|
149652
|
+
open: "/*",
|
|
149653
|
+
mid: " * ",
|
|
149654
|
+
close: " */"
|
|
149655
|
+
};
|
|
149656
|
+
var markupStyle = {
|
|
149657
|
+
kind: "block",
|
|
149658
|
+
open: "<!--",
|
|
149659
|
+
mid: " ",
|
|
149660
|
+
close: "-->"
|
|
149661
|
+
};
|
|
149662
|
+
var hashStyle = {
|
|
149663
|
+
kind: "line",
|
|
149664
|
+
prefix: "# "
|
|
149665
|
+
};
|
|
149666
|
+
var commentStyles = /* @__PURE__ */ new Map([
|
|
149667
|
+
["typescript", cStyle],
|
|
149668
|
+
["tsx", cStyle],
|
|
149669
|
+
["javascript", cStyle],
|
|
149670
|
+
["jsx", cStyle],
|
|
149671
|
+
["css", cStyle],
|
|
149672
|
+
["scss", cStyle],
|
|
149673
|
+
["less", cStyle],
|
|
149674
|
+
["html", markupStyle],
|
|
149675
|
+
["xml", markupStyle],
|
|
149676
|
+
["vue", markupStyle],
|
|
149677
|
+
["svelte", markupStyle],
|
|
149678
|
+
["bash", hashStyle],
|
|
149679
|
+
["sh", hashStyle],
|
|
149680
|
+
["shell", hashStyle],
|
|
149681
|
+
["yaml", hashStyle],
|
|
149682
|
+
["yml", hashStyle],
|
|
149683
|
+
["toml", hashStyle],
|
|
149684
|
+
["python", hashStyle],
|
|
149685
|
+
["ruby", hashStyle]
|
|
149686
|
+
]);
|
|
149687
|
+
var loomLogo = [
|
|
149688
|
+
"L OOOO OOOO M M",
|
|
149689
|
+
"L O O O O MM MM",
|
|
149690
|
+
"L O O O O M M M",
|
|
149691
|
+
"LLLL OOOO OOOO M M"
|
|
149692
|
+
];
|
|
149693
|
+
var bannerLines = (ascii, loom) => [
|
|
149694
|
+
...ascii ? [...loomLogo, ""] : [],
|
|
149695
|
+
`Tangled by Loom from ${loom} — composed from that`,
|
|
149696
|
+
`loom's code sections. Edit the loom and re-tangle;`,
|
|
149697
|
+
`changes made here are overwritten.`
|
|
149698
|
+
];
|
|
149699
|
+
var commentBlock = (style, lines) => value$1(style).pipe(when({ kind: "block" }, (s) => [
|
|
149700
|
+
s.open,
|
|
149701
|
+
...map$24(lines, (text) => `${s.mid}${text}`.trimEnd()),
|
|
149702
|
+
s.close
|
|
149703
|
+
].join("\n")), when({ kind: "line" }, (s) => map$24(lines, (text) => `${s.prefix}${text}`.trimEnd()).join("\n")), exhaustive);
|
|
149704
|
+
var belowShebang = (content, banner) => {
|
|
149705
|
+
const newline = content.indexOf("\n");
|
|
149706
|
+
const cut = content.startsWith("#!") && newline !== -1 ? newline + 1 : 0;
|
|
149707
|
+
return `${content.slice(0, cut)}${banner}\n\n${content.slice(cut)}`;
|
|
149708
|
+
};
|
|
149709
|
+
var stamped = (header, languageId, loom, content) => match$13(header, {
|
|
149710
|
+
onNone: () => content,
|
|
149711
|
+
onSome: ({ ascii }) => match$13(fromNullishOr$4(commentStyles.get(languageId)), {
|
|
149712
|
+
onNone: () => content,
|
|
149713
|
+
onSome: (style) => belowShebang(content, commentBlock(style, bannerLines(ascii, loom)))
|
|
149714
|
+
})
|
|
149715
|
+
});
|
|
149639
149716
|
var lineCharAt = (text, offset) => {
|
|
149640
149717
|
const before = text.slice(0, offset);
|
|
149641
149718
|
return {
|
|
@@ -149758,7 +149835,7 @@ var LoomCompiler = class extends Service$1()("LoomCompiler", { make: gen$1(funct
|
|
|
149758
149835
|
return failures.length > 0 ? fail$8(new TangleError({
|
|
149759
149836
|
entry: path,
|
|
149760
149837
|
failures
|
|
149761
|
-
})) : config.resolve(path).pipe(map$19(({ packageRoot }) => resolveSinks(scoped, path, fromNullishOr$4(packageRoot))));
|
|
149838
|
+
})) : config.resolve(path).pipe(map$19(({ packageRoot, header }) => resolveSinks(scoped, path, fromNullishOr$4(packageRoot), fromNullishOr$4(header))));
|
|
149762
149839
|
})),
|
|
149763
149840
|
composition: (path) => buildCorpus(documents, path).pipe(flatMap$7((modules) => forEach$8(fromIterable$15(modules.values()), (module) => config.resolve(module.path).pipe(map$19(({ packageRoot }) => map$24(module.product.files, (file) => ({
|
|
149764
149841
|
path: outputPath(fromNullishOr$4(packageRoot), module.path, file.path),
|
|
@@ -149855,4 +149932,4 @@ var removeService = (id, dir) => sync$3(() => rmSync(join(storeDir(dir), "node_m
|
|
|
149855
149932
|
//#endregion
|
|
149856
149933
|
export { mkString as $, done$2 as $n, ensuring$3 as $t, log as A, timeoutOrElse$1 as An, none$1 as Ar, mapDone as At, WatchBackend as B, provide$5 as Bn, dual as Br, acquireRelease$1 as Bt, errorExitCode as C, runFork as Cn, fromUndefinedOr as Cr, is$2 as Ct, Crypto as D, suspend$4 as Dn, isSome as Dr, fromIterable$10 as Dt, make$22 as E, succeed$6 as En, isNone as Er, toCodecStringTree as Et, TypeId$33 as F, catchDone as Fn, hasProperty as Fr, offerUnsafe as Ft, empty$9 as G, _await$1 as Gn, callback$2 as Gt, callback as H, succeed$8 as Hn, pipe as Hr, andThen as Ht, FileDescriptor as I, TaggedError as In, isNotNull as Ir, take$7 as It, fromEffect$1 as J, makeUnsafe$16 as Jn, catchTag$2 as Jt, filter$5 as K, doneUnsafe as Kn, catchCause$3 as Kt, FileSystem as L, taggedEnum as Ln, isNotUndefined as Lr, make$50 as Lt, FalseValues as M, try_ as Mn, String$5 as Mr, failCauseUnsafe as Mt, TrueValues as N, uninterruptible as Nn, BaseProto as Nr, make$48 as Nt, make$30 as O, sync$3 as On, map$29 as Or, get$21 as Ot, Path as P, void_$1 as Pn, format$5 as Pr, offer$2 as Pt, merge$1 as Q, UnknownError as Qn, effectify as Qt, FileTypeId as R, effect as Rn, isNullish as Rr, makeUnsafe$12 as Rt, make$13 as S, result$3 as Sn, fromNullishOr$4 as Sr, decodeUnknownEffect as St, makeRunMain as T, serviceOption$1 as Tn, getOrUndefined$2 as Tr, tag$2 as Tt, concat$2 as U, addFinalizer$1 as Un, pipeArguments as Ur, as$1 as Ut, make$33 as V, provideMerge as Vn, identity$1 as Vr, addFinalizer as Vt, decodeText as W, MinimumLogLevel as Wn, asVoid as Wt, isStream as X, succeed$10 as Xn, catch_$3 as Xt, groupedWithin as Y, fail$11 as Yn, catchTags$1 as Yt, mapEffect as Z, Done as Zn, die$3 as Zt, QuitError as _, orElseSucceed$1 as _n, fail$14 as _r, ErrorClass as _t, storeDir as a, forkScoped as an, make$69 as ar, transduce as at, make$11 as b, provideService$3 as bn, contains$3 as br, Struct as bt, LoomCompiler as c, interrupt$3 as cn, filter$15 as cr, make$35 as ct, stringSnapshot as d, map$19 as dn, groupBy$1 as dr, isSink as dt, fail$8 as en, fail$12 as er, orDie as et, PackageConfig as f, mapError$3 as fn, map$24 as fr, BadArgument as ft, dist_exports as g, orDie$2 as gn, sort$1 as gr, Defect as gt, ReadError as h, option$4 as hn, reduce$10 as hr, ArraySchema as ht, servicePackage as i, forever$2 as in, getUnsafe$11 as ir, splitLines$1 as it, Boolean$1 as j, tryPromise as jn, some$13 as jr, endUnsafe as jt, error$1 as k, tap$2 as kn, match$13 as kr, fromTransform$1 as kt, ignoredDirs as l, isEffect as ln, fromIterable$15 as lr, drain$1 as lt, SemanticTokenSchema as m, matchEffect as mn, of$2 as mr, systemError as mt, installedServices as n, fnUntraced as nn, Service$1 as nr, runCollect as nt, workspaceRoot as o, gen$1 as on, Prototype as or, unwrap$1 as ot, LoomConfig as p, match$3 as pn, match$11 as pr, badArgument as pt, fromChannel as q, isDone$1 as qn, catchFilter$2 as qt, removeService as r, forEach$8 as rn, empty$20 as rr, runForEach as rt, DocumentSource as s, ignore$3 as sn, dedupe$1 as sr, get$16 as st, addService as t, flatMap$7 as tn, Reference as tr, run$4 as tt, loomsUnder as u, logWarning as un, getSomes as ur, fromChannel$1 as ut, Terminal as v, provide$3 as vn, match$12 as vr, Literal as vt, errorReported as w, scoped$2 as wn, getOrElse$2 as wr, optional as wt, Stdio as x, raceFirst as xn, flatMap$13 as xr, Union as xt, isQuitError as y, provideContext$3 as yn, succeed$12 as yr, String$1 as yt, Size as z, mergeAll$2 as zn, isUndefined$1 as zr, nominal as zt };
|
|
149857
149934
|
|
|
149858
|
-
//# sourceMappingURL=LoomStore-
|
|
149935
|
+
//# sourceMappingURL=LoomStore-C2tWuEsJ.js.map
|