textlint-plugin-typst 1.0.1 → 1.1.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/README.md +1 -1
- package/lib/index.js +37 -20
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -40,7 +40,7 @@ bun add textlint-plugin-typst
|
|
|
40
40
|
|
|
41
41
|
## Syntax support
|
|
42
42
|
|
|
43
|
-
This plugin supports the syntax of Typst [v0.
|
|
43
|
+
This plugin supports the syntax of Typst [v0.12.0](https://github.com/typst/typst/releases/tag/v0.12.0).
|
|
44
44
|
|
|
45
45
|
Legend for syntax support:
|
|
46
46
|
|
package/lib/index.js
CHANGED
|
@@ -1375,21 +1375,29 @@ ${indent}`) + "'";
|
|
|
1375
1375
|
start = start.replace(/\n+/g, `$&${indent}`);
|
|
1376
1376
|
}
|
|
1377
1377
|
const indentSize = indent ? "2" : "1";
|
|
1378
|
-
let header = (
|
|
1378
|
+
let header = (startWithSpace ? indentSize : "") + chomp;
|
|
1379
1379
|
if (comment) {
|
|
1380
1380
|
header += " " + commentString(comment.replace(/ ?[\r\n]+/g, " "));
|
|
1381
1381
|
if (onComment)
|
|
1382
1382
|
onComment();
|
|
1383
1383
|
}
|
|
1384
|
-
if (literal) {
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1384
|
+
if (!literal) {
|
|
1385
|
+
const foldedValue = value.replace(/\n+/g, "\n$&").replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, "$1$2").replace(/\n+/g, `$&${indent}`);
|
|
1386
|
+
let literalFallback = false;
|
|
1387
|
+
const foldOptions = getFoldOptions(ctx, true);
|
|
1388
|
+
if (blockQuote !== "folded" && type !== Scalar.Scalar.BLOCK_FOLDED) {
|
|
1389
|
+
foldOptions.onOverflow = () => {
|
|
1390
|
+
literalFallback = true;
|
|
1391
|
+
};
|
|
1392
|
+
}
|
|
1393
|
+
const body = foldFlowLines.foldFlowLines(`${start}${foldedValue}${end}`, indent, foldFlowLines.FOLD_BLOCK, foldOptions);
|
|
1394
|
+
if (!literalFallback)
|
|
1395
|
+
return `>${header}
|
|
1392
1396
|
${indent}${body}`;
|
|
1397
|
+
}
|
|
1398
|
+
value = value.replace(/\n+/g, `$&${indent}`);
|
|
1399
|
+
return `|${header}
|
|
1400
|
+
${indent}${start}${value}${end}`;
|
|
1393
1401
|
}
|
|
1394
1402
|
function plainString(item, ctx, onComment, onChompKeep) {
|
|
1395
1403
|
const { type, value } = item;
|
|
@@ -2584,7 +2592,7 @@ var require_schema2 = __commonJS({
|
|
|
2584
2592
|
identify: (value) => typeof value === "boolean",
|
|
2585
2593
|
default: true,
|
|
2586
2594
|
tag: "tag:yaml.org,2002:bool",
|
|
2587
|
-
test: /^true
|
|
2595
|
+
test: /^true$|^false$/,
|
|
2588
2596
|
resolve: (str) => str === "true",
|
|
2589
2597
|
stringify: stringifyJSON
|
|
2590
2598
|
},
|
|
@@ -3168,7 +3176,7 @@ var require_timestamp = __commonJS({
|
|
|
3168
3176
|
}
|
|
3169
3177
|
return new Date(date);
|
|
3170
3178
|
},
|
|
3171
|
-
stringify: ({ value }) => value.toISOString().replace(/(
|
|
3179
|
+
stringify: ({ value }) => value.toISOString().replace(/(T00:00:00)?\.000Z$/, "")
|
|
3172
3180
|
};
|
|
3173
3181
|
exports2.floatTime = floatTime;
|
|
3174
3182
|
exports2.intTime = intTime;
|
|
@@ -7540,16 +7548,14 @@ replaceTraps((oldTraps) => ({
|
|
|
7540
7548
|
|
|
7541
7549
|
// node_modules/@myriaddreamin/typst.ts/dist/esm/init.mjs
|
|
7542
7550
|
var ComponentBuilder = class {
|
|
7543
|
-
|
|
7544
|
-
|
|
7545
|
-
this.fetcher = fetch;
|
|
7546
|
-
}
|
|
7551
|
+
loadedFonts = /* @__PURE__ */ new Set();
|
|
7552
|
+
fetcher = fetch;
|
|
7547
7553
|
setFetcher(fetcher) {
|
|
7548
7554
|
this.fetcher = fetcher;
|
|
7549
7555
|
}
|
|
7550
7556
|
async loadFonts(builder, fonts) {
|
|
7551
7557
|
const escapeImport = new Function("m", "return import(m)");
|
|
7552
|
-
const fetcher = this.fetcher
|
|
7558
|
+
const fetcher = this.fetcher ||= await async function() {
|
|
7553
7559
|
const { fetchBuilder, FileSystemCache } = await escapeImport("node-fetch-cache");
|
|
7554
7560
|
const cache = new FileSystemCache({
|
|
7555
7561
|
/// By default, we don't have a complicated cache policy.
|
|
@@ -7564,7 +7570,7 @@ var ComponentBuilder = class {
|
|
|
7564
7570
|
clearTimeout(timeout);
|
|
7565
7571
|
});
|
|
7566
7572
|
};
|
|
7567
|
-
}()
|
|
7573
|
+
}();
|
|
7568
7574
|
const fontsToLoad = fonts.filter((font) => {
|
|
7569
7575
|
if (font instanceof Uint8Array) {
|
|
7570
7576
|
return true;
|
|
@@ -7685,6 +7691,8 @@ var once = (fn) => {
|
|
|
7685
7691
|
};
|
|
7686
7692
|
};
|
|
7687
7693
|
var LazyWasmModule = class {
|
|
7694
|
+
wasmBin;
|
|
7695
|
+
initOnce;
|
|
7688
7696
|
constructor(initFn) {
|
|
7689
7697
|
if (typeof initFn !== "function") {
|
|
7690
7698
|
throw new Error("initFn is not a function");
|
|
@@ -7701,6 +7709,10 @@ var LazyWasmModule = class {
|
|
|
7701
7709
|
|
|
7702
7710
|
// node_modules/@myriaddreamin/typst.ts/dist/esm/compiler.mjs
|
|
7703
7711
|
var IncrementalServer = class {
|
|
7712
|
+
/**
|
|
7713
|
+
* @internal
|
|
7714
|
+
*/
|
|
7715
|
+
[kObject];
|
|
7704
7716
|
/**
|
|
7705
7717
|
* @internal
|
|
7706
7718
|
*/
|
|
@@ -7734,6 +7746,8 @@ function createTypstCompiler() {
|
|
|
7734
7746
|
return new TypstCompilerDriver();
|
|
7735
7747
|
}
|
|
7736
7748
|
var TypstCompilerDriver = class {
|
|
7749
|
+
compiler;
|
|
7750
|
+
compilerJs;
|
|
7737
7751
|
constructor() {
|
|
7738
7752
|
}
|
|
7739
7753
|
async init(options) {
|
|
@@ -7753,15 +7767,15 @@ var TypstCompilerDriver = class {
|
|
|
7753
7767
|
compile(options) {
|
|
7754
7768
|
return new Promise((resolve) => {
|
|
7755
7769
|
if ("incrementalServer" in options) {
|
|
7756
|
-
resolve(this.compiler.incr_compile(options.mainFilePath, options.incrementalServer[kObject], getDiagnosticsArg(options.diagnostics)));
|
|
7770
|
+
resolve(this.compiler.incr_compile(options.mainFilePath, convertInputs(options.inputs), options.incrementalServer[kObject], getDiagnosticsArg(options.diagnostics)));
|
|
7757
7771
|
return;
|
|
7758
7772
|
}
|
|
7759
|
-
resolve(this.compiler.compile(options.mainFilePath, options.format || "vector", getDiagnosticsArg(options.diagnostics)));
|
|
7773
|
+
resolve(this.compiler.compile(options.mainFilePath, convertInputs(options.inputs), options.format || "vector", getDiagnosticsArg(options.diagnostics)));
|
|
7760
7774
|
});
|
|
7761
7775
|
}
|
|
7762
7776
|
query(options) {
|
|
7763
7777
|
return new Promise((resolve) => {
|
|
7764
|
-
resolve(JSON.parse(this.compiler.query(options.mainFilePath, options.selector, options.field)));
|
|
7778
|
+
resolve(JSON.parse(this.compiler.query(options.mainFilePath, convertInputs(options.inputs), options.selector, options.field)));
|
|
7765
7779
|
});
|
|
7766
7780
|
}
|
|
7767
7781
|
getSemanticTokenLegend() {
|
|
@@ -7811,6 +7825,9 @@ var TypstCompilerDriver = class {
|
|
|
7811
7825
|
throw new Error("Please use the api TypstRenderer.renderToCanvas in v0.4.0");
|
|
7812
7826
|
}
|
|
7813
7827
|
};
|
|
7828
|
+
function convertInputs(inputs) {
|
|
7829
|
+
return inputs ? Object.entries(inputs) : void 0;
|
|
7830
|
+
}
|
|
7814
7831
|
function getDiagnosticsArg(diagnostics) {
|
|
7815
7832
|
switch (diagnostics) {
|
|
7816
7833
|
case "none":
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "textlint-plugin-typst",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "textlint plugin to lint Typst",
|
|
5
5
|
"keywords": ["textlint", "textlintplugin", "plugin", "lint", "typst"],
|
|
6
6
|
"repository": "https://github.com/3w36zj6/textlint-plugin-typst",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"update-fixtures": "bun ./test/update-fixtures.ts && biome check --write ./test/fixtures"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@myriaddreamin/typst-ts-web-compiler": "^0.5.
|
|
29
|
-
"@myriaddreamin/typst.ts": "^0.5.
|
|
28
|
+
"@myriaddreamin/typst-ts-web-compiler": "^0.5.1",
|
|
29
|
+
"@myriaddreamin/typst.ts": "^0.5.1",
|
|
30
30
|
"yaml": "^2.5.1"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|