aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2022-02-23 16:12:34 -0300
committerSebastian <sebasjm@gmail.com>2022-02-24 12:50:53 -0300
commit7774f3508f6afa6abdc116558ea2c019b79ab33b (patch)
tree5b642ea5ad6202004be36341c89e2668cfeb6b3f
parent8c3e57293422d670b93c2f2a19cfc47f3aecc7b1 (diff)
adding self closing jsx element
-rw-r--r--packages/pogen/src/potextract.ts15
1 files changed, 6 insertions, 9 deletions
diff --git a/packages/pogen/src/potextract.ts b/packages/pogen/src/potextract.ts
index 5cc085ef8..8961c8da0 100644
--- a/packages/pogen/src/potextract.ts
+++ b/packages/pogen/src/potextract.ts
@@ -19,8 +19,7 @@
*/
import * as ts from "typescript";
import * as fs from "fs";
-import * as os from "os";
-import path = require("path/posix");
+import * as path from "path"
function wordwrap(str: string, width: number = 80): string[] {
var regex = ".{1," + width + "}(\\s|$)|\\S+(\\s|$)";
@@ -146,7 +145,7 @@ function processFile(
outChunks.push(`#. ${cl}\n`);
}
}
- const fn = path.relative(process.cwd(), sourceFile.fileName);
+ const fn = path.posix.relative(process.cwd(), sourceFile.fileName);
outChunks.push(`#: ${fn}:${line + 1}\n`);
outChunks.push(`#, c-format\n`);
}
@@ -218,6 +217,7 @@ function processFile(
}
case ts.SyntaxKind.JsxOpeningElement:
break;
+ case ts.SyntaxKind.JsxSelfClosingElement:
case ts.SyntaxKind.JsxElement:
fragments.push(`%${holeNum[0]++}$s`);
break;
@@ -229,16 +229,13 @@ function processFile(
case ts.SyntaxKind.JsxClosingElement:
break;
default:
+ console.log("unhandled node type: ", childNode.kind)
let lc = ts.getLineAndCharacterOfPosition(
childNode.getSourceFile(),
childNode.getStart(),
);
console.error(
- `unrecognized syntax in JSX Element ${
- ts.SyntaxKind[childNode.kind]
- } (${childNode.getSourceFile().fileName}:${lc.line + 1}:${
- lc.character + 1
- }`,
+ `unrecognized syntax in JSX Element ${ts.SyntaxKind[childNode.kind]} (${childNode.getSourceFile().fileName}:${lc.line + 1}:${lc.character + 1}`,
);
break;
}
@@ -420,7 +417,7 @@ export function potextract() {
!prog.isSourceFileDefaultLibrary(x),
);
- //console.log(ownFiles.map((x) => x.fileName));
+ // console.log(ownFiles.map((x) => x.fileName));
const chunks = [];