|
|
|
@ -54,11 +54,23 @@ for (const category of fs.readdirSync('messages')) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param {string} name
|
|
|
|
|
* @param {string} dest
|
|
|
|
|
*/
|
|
|
|
|
function transform(name, dest) {
|
|
|
|
|
const source = fs
|
|
|
|
|
.readFileSync(new URL(`./templates/${name}.js`, import.meta.url), 'utf-8')
|
|
|
|
|
.replace(/\r\n/g, '\n');
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @type {Array<{
|
|
|
|
|
* type: string;
|
|
|
|
|
* value: string;
|
|
|
|
|
* start: number;
|
|
|
|
|
* end: number
|
|
|
|
|
* }>}
|
|
|
|
|
*/
|
|
|
|
|
const comments = [];
|
|
|
|
|
|
|
|
|
|
let ast = acorn.parse(source, {
|
|
|
|
@ -135,6 +147,7 @@ function transform(name, dest) {
|
|
|
|
|
|
|
|
|
|
for (const code in category) {
|
|
|
|
|
const { messages } = category[code];
|
|
|
|
|
/** @type {string[]} */
|
|
|
|
|
const vars = [];
|
|
|
|
|
|
|
|
|
|
const group = messages.map((text, i) => {
|
|
|
|
@ -225,7 +238,7 @@ function transform(name, dest) {
|
|
|
|
|
Block(node, context) {
|
|
|
|
|
if (!node.value.includes('PARAMETER')) return;
|
|
|
|
|
|
|
|
|
|
const value = node.value
|
|
|
|
|
const value = /** @type {string} */ (node.value)
|
|
|
|
|
.split('\n')
|
|
|
|
|
.map((line) => {
|
|
|
|
|
if (line === ' * MESSAGE') {
|
|
|
|
|