@tolgee/cli
Advanced tools
Comparing version
import { extname } from 'path'; | ||
import { interpret } from 'xstate'; | ||
import reactExtractorMachine from './machines/react.js'; | ||
import vueExtractorMachine from './machines/vue/extract.js'; | ||
import svelteExtractorMachine from './machines/svelte.js'; | ||
import commentsExtractorMachine from './machines/comments.js'; | ||
import vueSfcProcessor from './processors/vueSfc.js'; | ||
import tokenizer from './tokenizer.js'; | ||
@@ -17,2 +19,3 @@ const REACT_EXTS = [ | ||
]; | ||
const VUE_EXTS = REACT_EXTS; | ||
const ALL_EXTS = [ | ||
@@ -29,7 +32,9 @@ '.js', | ||
]; | ||
function pickMachine(code, fileName) { | ||
const ext = extname(fileName); | ||
function pickMachine(code, ext) { | ||
if (REACT_EXTS.includes(ext) && code.includes('@tolgee/react')) { | ||
return reactExtractorMachine; | ||
} | ||
if (VUE_EXTS.includes(ext) && code.includes('@tolgee/vue')) { | ||
return vueExtractorMachine; | ||
} | ||
if (ext === '.svelte' && code.includes('@tolgee/svelte')) { | ||
@@ -45,3 +50,11 @@ return svelteExtractorMachine; | ||
export default async function extractor(code, fileName) { | ||
const machineSpec = pickMachine(code, fileName); | ||
const ext = extname(fileName); | ||
if (ext === '.vue' && | ||
(code.includes('$t') || | ||
code.includes('@tolgee/vue') || | ||
code.includes('@tolgee-key') || | ||
code.includes('@tolgee-ignore'))) { | ||
return vueSfcProcessor(code, fileName); | ||
} | ||
const machineSpec = pickMachine(code, ext); | ||
if (!machineSpec) { | ||
@@ -48,0 +61,0 @@ return { warnings: [], keys: [] }; |
import { createMachine, assign, send, forwardTo } from 'xstate'; | ||
import translateCallMachine from './shared/translateCall.js'; | ||
import propertiesMachine from './shared/properties.js'; | ||
@@ -459,101 +460,28 @@ import commentsService from './shared/comments.js'; | ||
call: { | ||
on: { | ||
'punctuation.definition.string.begin.ts': 'param_string', | ||
'punctuation.definition.string.template.begin.ts': 'param_string', | ||
'variable.other.readwrite.ts': [ | ||
invoke: { | ||
id: 'tCall', | ||
src: translateCallMachine, | ||
onDone: [ | ||
{ | ||
target: 'idle', | ||
actions: 'dynamicOptions', | ||
cond: (ctx) => !!ctx.key.keyName, | ||
}, | ||
{ | ||
target: 'idle', | ||
actions: 'dynamicKeyName', | ||
cond: (_, evt) => evt.data.keyName === false, | ||
}, | ||
], | ||
'punctuation.definition.block.ts': { | ||
target: 'param_object', | ||
cond: (_ctx, evt) => evt.token === '{', | ||
}, | ||
'meta.brace.round.ts': { | ||
target: 'idle', | ||
cond: (_ctx, evt) => evt.token === ')', | ||
actions: 'pushKey', | ||
}, | ||
}, | ||
}, | ||
param_string: { | ||
on: { | ||
'*': [ | ||
{ | ||
target: 'param_end', | ||
actions: ['storeKeyName', 'storeKeyCurrentNamespace'], | ||
cond: (ctx) => !ctx.key.keyName, | ||
}, | ||
{ | ||
target: 'param_end', | ||
actions: ['storeKeyDefault', 'storeKeyCurrentNamespace'], | ||
cond: (ctx) => !!ctx.key.keyName, | ||
}, | ||
], | ||
}, | ||
}, | ||
param_end: { | ||
on: { | ||
'punctuation.separator.comma.ts': 'call', | ||
'punctuation.definition.template-expression.begin.ts': [ | ||
{ | ||
target: 'param_end_warn', | ||
actions: 'dynamicKeyDefault', | ||
cond: (ctx) => !!ctx.key.defaultValue, | ||
}, | ||
{ | ||
target: 'idle', | ||
actions: 'dynamicKeyName', | ||
actions: 'dynamicNamespace', | ||
cond: (_, evt) => evt.data.namespace === false, | ||
}, | ||
], | ||
'keyword.operator.arithmetic.ts': [ | ||
{ | ||
target: 'param_end_warn', | ||
actions: 'dynamicKeyDefault', | ||
cond: (ctx) => !!ctx.key.defaultValue, | ||
}, | ||
{ | ||
target: 'idle', | ||
actions: 'dynamicKeyName', | ||
actions: 'dynamicOptions', | ||
cond: (_, evt) => evt.data.dynamicOptions, | ||
}, | ||
], | ||
'meta.brace.round.ts': { | ||
target: 'idle', | ||
cond: (_ctx, evt) => evt.token === ')', | ||
actions: 'pushKey', | ||
}, | ||
}, | ||
}, | ||
param_end_warn: { | ||
on: { | ||
'punctuation.separator.comma.ts': 'call', | ||
'meta.brace.round.ts': { | ||
target: 'idle', | ||
cond: (_ctx, evt) => evt.token === ')', | ||
actions: 'pushKey', | ||
}, | ||
}, | ||
}, | ||
param_object: { | ||
invoke: { | ||
id: 'propertiesMachine', | ||
src: propertiesMachine, | ||
data: { | ||
depth: 1, | ||
}, | ||
onDone: [ | ||
{ | ||
target: 'idle', | ||
actions: 'emitWarningFromParameters', | ||
cond: 'isPropertiesDataDynamic', | ||
cond: (_, evt) => !evt.data.keyName, | ||
}, | ||
{ | ||
target: 'idle', | ||
actions: ['consumeParameters', 'pushKey'], | ||
actions: 'consumeTranslateCall', | ||
}, | ||
@@ -564,3 +492,3 @@ ], | ||
'*': { | ||
actions: forwardTo('propertiesMachine'), | ||
actions: forwardTo('tCall'), | ||
}, | ||
@@ -618,2 +546,39 @@ }, | ||
}), | ||
consumeTranslateCall: assign({ | ||
warnings: (ctx, evt) => { | ||
const utNamespace = ctx.hooks.length | ||
? ctx.hooks[ctx.hooks.length - 1].namespace | ||
: undefined; | ||
if (!evt.data.namespace && utNamespace === false) { | ||
return [ | ||
...ctx.warnings, | ||
{ warning: 'W_UNRESOLVABLE_NAMESPACE', line: ctx.line }, | ||
]; | ||
} | ||
if (evt.data.defaultValue === false) { | ||
return [ | ||
...ctx.warnings, | ||
{ warning: 'W_DYNAMIC_DEFAULT_VALUE', line: ctx.line }, | ||
]; | ||
} | ||
return ctx.warnings; | ||
}, | ||
keys: (ctx, evt) => { | ||
const utNamespace = ctx.hooks.length | ||
? ctx.hooks[ctx.hooks.length - 1].namespace | ||
: undefined; | ||
const ns = evt.data.namespace === null ? utNamespace : evt.data.namespace; | ||
if (!evt.data.keyName || ns === false) | ||
return ctx.keys; | ||
return [ | ||
...ctx.keys, | ||
{ | ||
keyName: evt.data.keyName, | ||
namespace: ns || undefined, | ||
defaultValue: evt.data.defaultValue || undefined, | ||
line: ctx.line, | ||
}, | ||
]; | ||
}, | ||
}), | ||
consumeParameters: assign({ | ||
@@ -649,3 +614,3 @@ key: (ctx, evt) => ({ | ||
], | ||
key: (_ctx, _evt) => VOID_KEY, | ||
key: VOID_KEY, | ||
}), | ||
@@ -669,10 +634,2 @@ appendChildren: assign({ | ||
}), | ||
storeKeyCurrentNamespace: assign({ | ||
key: (ctx, _evt) => ({ | ||
...ctx.key, | ||
namespace: ctx.hooks.length | ||
? ctx.hooks[ctx.hooks.length - 1].namespace | ||
: undefined, | ||
}), | ||
}), | ||
dynamicKeyName: assign({ | ||
@@ -683,4 +640,11 @@ warnings: (ctx, _evt) => [ | ||
], | ||
key: (_ctx, _evt) => VOID_KEY, | ||
key: VOID_KEY, | ||
}), | ||
dynamicNamespace: assign({ | ||
warnings: (ctx, _evt) => [ | ||
...ctx.warnings, | ||
{ warning: 'W_DYNAMIC_NAMESPACE', line: ctx.line }, | ||
], | ||
key: VOID_KEY, | ||
}), | ||
dynamicKeyDefault: assign({ | ||
@@ -694,3 +658,3 @@ key: (ctx, _evt) => ({ ...ctx.key, defaultValue: undefined }), | ||
dynamicOptions: assign({ | ||
key: (ctx, _evt) => VOID_KEY, | ||
key: VOID_KEY, | ||
warnings: (ctx, _evt) => [ | ||
@@ -714,10 +678,2 @@ ...ctx.warnings, | ||
pushKey: assign({ | ||
warnings: (ctx, _evt) => { | ||
if (!ctx.key.keyName || ctx.key.namespace !== false) | ||
return ctx.warnings; | ||
return [ | ||
...ctx.warnings, | ||
{ warning: 'W_UNRESOLVABLE_NAMESPACE', line: ctx.line }, | ||
]; | ||
}, | ||
keys: (ctx, _evt) => { | ||
@@ -724,0 +680,0 @@ if (!ctx.key.keyName || ctx.key.namespace === false) |
@@ -11,2 +11,3 @@ import { createMachine, send, assign } from 'xstate'; | ||
static: false, | ||
nextDynamic: false, | ||
keyName: null, | ||
@@ -51,2 +52,33 @@ defaultValue: null, | ||
}, | ||
// Vue | ||
'punctuation.attribute-shorthand.event.html.vue': [ | ||
{ | ||
cond: (_, evt) => evt.token === '@', | ||
actions: ['markPropertyAsDynamic', 'markNextPropertyAsDynamic'], | ||
}, | ||
], | ||
'entity.other.attribute-name.html.vue': [ | ||
{ | ||
cond: (ctx) => ctx.nextDynamic, | ||
actions: 'markImmediatePropertyAsDynamic', | ||
}, | ||
{ | ||
actions: [ | ||
'markPropertyAsDynamic', | ||
'unmarkAsStatic', | ||
'storePropertyType', | ||
], | ||
}, | ||
], | ||
'punctuation.separator.key-value.html.vue': { | ||
target: 'value', | ||
}, | ||
'entity.other.attribute-name.html': [ | ||
{ | ||
actions: ['markPropertyAsDynamic', 'storePropertyType'], | ||
}, | ||
], | ||
'punctuation.separator.key-value.html': { | ||
target: 'value', | ||
}, | ||
}, | ||
@@ -81,2 +113,3 @@ }, | ||
'punctuation.definition.string.template.begin.svelte': 'value_string', | ||
'punctuation.definition.string.begin.html': 'value_string', | ||
// Variable | ||
@@ -104,2 +137,11 @@ 'variable.other.readwrite.ts': { | ||
}, | ||
// Vue | ||
'string.unquoted.html': { | ||
target: 'idle', | ||
actions: [ | ||
'storePropertyValue', | ||
'clearPropertyType', | ||
'unmarkAsStatic', | ||
], | ||
}, | ||
// Value end | ||
@@ -144,2 +186,6 @@ 'punctuation.separator.comma.ts': { | ||
}, | ||
'punctuation.definition.string.end.html': { | ||
target: 'idle', | ||
actions: ['storeEmptyPropertyValue', 'clearPropertyType'], | ||
}, | ||
'*': [ | ||
@@ -194,2 +240,11 @@ { | ||
}, | ||
// Vue | ||
'punctuation.definition.string.end.html.vue': { | ||
target: 'idle', | ||
actions: 'clearPropertyType', | ||
}, | ||
'punctuation.definition.string.end.html': { | ||
target: 'idle', | ||
actions: 'clearPropertyType', | ||
}, | ||
}, | ||
@@ -230,2 +285,10 @@ }, | ||
}, | ||
'punctuation.definition.tag.end.html.vue': { | ||
target: 'end', | ||
actions: 'markPropertyAsDynamic', | ||
}, | ||
'punctuation.definition.tag.end.html': { | ||
target: 'end', | ||
actions: 'markPropertyAsDynamic', | ||
}, | ||
}, | ||
@@ -236,6 +299,10 @@ }, { | ||
!evt.scopes.includes('meta.embedded.expression.tsx') && | ||
!evt.scopes.includes('meta.embedded.expression.svelte'), | ||
!evt.scopes.includes('meta.embedded.expression.svelte') && | ||
(!evt.scopes.includes('source.ts.embedded.html.vue') || | ||
evt.scopes.includes('expression.embedded.vue')), | ||
isCloseCurly: (_ctx, evt) => evt.token === '}' && | ||
!evt.scopes.includes('meta.embedded.expression.tsx') && | ||
!evt.scopes.includes('meta.embedded.expression.svelte'), | ||
!evt.scopes.includes('meta.embedded.expression.svelte') && | ||
(!evt.scopes.includes('source.ts.embedded.html.vue') || | ||
evt.scopes.includes('expression.embedded.vue')), | ||
isFinalCloseCurly: (ctx, evt) => evt.token === '}' && ctx.depth === 1, | ||
@@ -267,3 +334,7 @@ isOpenSquare: (_ctx, evt) => evt.token === '[', | ||
}), | ||
markNextPropertyAsDynamic: assign({ | ||
nextDynamic: true, | ||
}), | ||
markPropertyAsDynamic: assign({ | ||
nextDynamic: false, | ||
keyName: (ctx, _evt) => ctx.property === 'key' || ctx.property === 'keyName' | ||
@@ -276,2 +347,3 @@ ? false | ||
markImmediatePropertyAsDynamic: assign({ | ||
nextDynamic: false, | ||
keyName: (ctx, evt) => evt.token === 'key' || evt.token === 'keyName' ? false : ctx.keyName, | ||
@@ -288,8 +360,8 @@ defaultValue: (ctx, evt) => evt.token === 'defaultValue' ? false : ctx.defaultValue, | ||
markAsStatic: assign({ | ||
static: (_ctx, _evt) => true, | ||
static: true, | ||
}), | ||
unmarkAsStatic: assign({ | ||
static: (_ctx, _evt) => false, | ||
static: false, | ||
}), | ||
}, | ||
}); |
import { createMachine, assign, send, forwardTo } from 'xstate'; | ||
import translateCallMachine from './shared/translateCall.js'; | ||
import propertiesMachine from './shared/properties.js'; | ||
@@ -240,101 +241,28 @@ import commentsService from './shared/comments.js'; | ||
call: { | ||
on: { | ||
'punctuation.definition.string.begin.ts': 'param_string', | ||
'punctuation.definition.string.template.begin.ts': 'param_string', | ||
'variable.other.readwrite.ts': [ | ||
invoke: { | ||
id: 'tCall', | ||
src: translateCallMachine, | ||
onDone: [ | ||
{ | ||
target: 'idle', | ||
actions: 'dynamicOptions', | ||
cond: (ctx) => !!ctx.key.keyName, | ||
}, | ||
{ | ||
target: 'idle', | ||
actions: 'dynamicKeyName', | ||
cond: (_, evt) => evt.data.keyName === false, | ||
}, | ||
], | ||
'punctuation.definition.block.ts': { | ||
target: 'param_object', | ||
cond: (_ctx, evt) => evt.token === '{', | ||
}, | ||
'meta.brace.round.ts': { | ||
target: 'idle', | ||
cond: (_ctx, evt) => evt.token === ')', | ||
actions: 'pushKey', | ||
}, | ||
}, | ||
}, | ||
param_string: { | ||
on: { | ||
'*': [ | ||
{ | ||
target: 'param_end', | ||
actions: ['storeKeyName', 'storeKeyCurrentNamespace'], | ||
cond: (ctx) => !ctx.key.keyName, | ||
}, | ||
{ | ||
target: 'param_end', | ||
actions: ['storeKeyDefault', 'storeKeyCurrentNamespace'], | ||
cond: (ctx) => !!ctx.key.keyName, | ||
}, | ||
], | ||
}, | ||
}, | ||
param_end: { | ||
on: { | ||
'punctuation.separator.comma.ts': 'call', | ||
'punctuation.definition.template-expression.begin.ts': [ | ||
{ | ||
target: 'param_end_warn', | ||
actions: 'dynamicKeyDefault', | ||
cond: (ctx) => !!ctx.key.defaultValue, | ||
}, | ||
{ | ||
target: 'idle', | ||
actions: 'dynamicKeyName', | ||
actions: 'dynamicNamespace', | ||
cond: (_, evt) => evt.data.namespace === false, | ||
}, | ||
], | ||
'keyword.operator.arithmetic.ts': [ | ||
{ | ||
target: 'param_end_warn', | ||
actions: 'dynamicKeyDefault', | ||
cond: (ctx) => !!ctx.key.defaultValue, | ||
}, | ||
{ | ||
target: 'idle', | ||
actions: 'dynamicKeyName', | ||
actions: 'dynamicOptions', | ||
cond: (_, evt) => evt.data.dynamicOptions, | ||
}, | ||
], | ||
'meta.brace.round.ts': { | ||
target: 'idle', | ||
cond: (_ctx, evt) => evt.token === ')', | ||
actions: 'pushKey', | ||
}, | ||
}, | ||
}, | ||
param_end_warn: { | ||
on: { | ||
'punctuation.separator.comma.ts': 'call', | ||
'meta.brace.round.ts': { | ||
target: 'idle', | ||
cond: (_ctx, evt) => evt.token === ')', | ||
actions: 'pushKey', | ||
}, | ||
}, | ||
}, | ||
param_object: { | ||
invoke: { | ||
id: 'propertiesMachine', | ||
src: propertiesMachine, | ||
data: { | ||
depth: 1, | ||
}, | ||
onDone: [ | ||
{ | ||
target: 'idle', | ||
actions: 'emitWarningFromParameters', | ||
cond: 'isPropertiesDataDynamic', | ||
cond: (_, evt) => !evt.data.keyName, | ||
}, | ||
{ | ||
target: 'idle', | ||
actions: ['consumeParameters', 'pushKey'], | ||
actions: 'consumeTranslateCall', | ||
}, | ||
@@ -345,3 +273,3 @@ ], | ||
'*': { | ||
actions: forwardTo('propertiesMachine'), | ||
actions: forwardTo('tCall'), | ||
}, | ||
@@ -386,2 +314,33 @@ }, | ||
}), | ||
consumeTranslateCall: assign({ | ||
warnings: (ctx, evt) => { | ||
if (!evt.data.namespace && ctx.getTranslate === false) { | ||
return [ | ||
...ctx.warnings, | ||
{ warning: 'W_UNRESOLVABLE_NAMESPACE', line: ctx.line }, | ||
]; | ||
} | ||
if (evt.data.defaultValue === false) { | ||
return [ | ||
...ctx.warnings, | ||
{ warning: 'W_DYNAMIC_DEFAULT_VALUE', line: ctx.line }, | ||
]; | ||
} | ||
return ctx.warnings; | ||
}, | ||
keys: (ctx, evt) => { | ||
const ns = evt.data.namespace === null ? ctx.getTranslate : evt.data.namespace; | ||
if (!evt.data.keyName || ns === false) | ||
return ctx.keys; | ||
return [ | ||
...ctx.keys, | ||
{ | ||
keyName: evt.data.keyName, | ||
namespace: ns || undefined, | ||
defaultValue: evt.data.defaultValue || undefined, | ||
line: ctx.line, | ||
}, | ||
]; | ||
}, | ||
}), | ||
consumeParameters: assign({ | ||
@@ -413,16 +372,4 @@ key: (ctx, evt) => ({ | ||
], | ||
key: (_ctx, _evt) => VOID_KEY, | ||
key: VOID_KEY, | ||
}), | ||
storeKeyName: assign({ | ||
key: (ctx, evt) => ({ ...ctx.key, keyName: evt.token }), | ||
}), | ||
storeKeyDefault: assign({ | ||
key: (ctx, evt) => ({ ...ctx.key, defaultValue: evt.token }), | ||
}), | ||
storeKeyCurrentNamespace: assign({ | ||
key: (ctx, _evt) => ({ | ||
...ctx.key, | ||
namespace: ctx.getTranslate !== null ? ctx.getTranslate : undefined, | ||
}), | ||
}), | ||
dynamicKeyName: assign({ | ||
@@ -433,13 +380,13 @@ warnings: (ctx, _evt) => [ | ||
], | ||
key: (_ctx, _evt) => VOID_KEY, | ||
key: VOID_KEY, | ||
}), | ||
dynamicKeyDefault: assign({ | ||
key: (ctx, _evt) => ({ ...ctx.key, defaultValue: undefined }), | ||
dynamicNamespace: assign({ | ||
warnings: (ctx, _evt) => [ | ||
...ctx.warnings, | ||
{ warning: 'W_DYNAMIC_DEFAULT_VALUE', line: ctx.line }, | ||
{ warning: 'W_DYNAMIC_NAMESPACE', line: ctx.line }, | ||
], | ||
key: VOID_KEY, | ||
}), | ||
dynamicOptions: assign({ | ||
key: (_ctx, _evt) => VOID_KEY, | ||
key: VOID_KEY, | ||
warnings: (ctx, _evt) => [ | ||
@@ -451,10 +398,2 @@ ...ctx.warnings, | ||
pushKey: assign({ | ||
warnings: (ctx, _evt) => { | ||
if (!ctx.key.keyName || ctx.key.namespace !== false) | ||
return ctx.warnings; | ||
return [ | ||
...ctx.warnings, | ||
{ warning: 'W_UNRESOLVABLE_NAMESPACE', line: ctx.line }, | ||
]; | ||
}, | ||
keys: (ctx, _evt) => { | ||
@@ -461,0 +400,0 @@ if (!ctx.key.keyName || ctx.key.namespace === false) |
@@ -11,2 +11,5 @@ import { extname } from 'path'; | ||
["source.svelte" /* Grammar.SVELTE */]: new URL('Svelte.tmLanguage', GRAMMAR_PATH), | ||
["source.vue" /* Grammar.VUE */]: new URL('Vue.tmLanguage', GRAMMAR_PATH), | ||
["text.html.basic" /* Grammar.HTML */]: new URL('HTML.tmLanguage', GRAMMAR_PATH), | ||
["text.html.derivative" /* Grammar.HTML_D */]: new URL('HTML.tmLanguage', GRAMMAR_PATH), | ||
}; | ||
@@ -32,5 +35,3 @@ let oniguruma; | ||
const grammar = await readFile(file, 'utf8'); | ||
return grammar.startsWith('{') | ||
? JSON.parse(grammar) | ||
: TextMate.parseRawGrammar(grammar); | ||
return JSON.parse(grammar); | ||
} | ||
@@ -49,4 +50,8 @@ function extnameToGrammar(extname) { | ||
return "source.tsx" /* Grammar.TYPESCRIPT_TSX */; | ||
case '.vue': | ||
return "source.vue" /* Grammar.VUE */; | ||
case '.svelte': | ||
return "source.svelte" /* Grammar.SVELTE */; | ||
case '.html': | ||
return "text.html.basic" /* Grammar.HTML */; | ||
} | ||
@@ -63,6 +68,6 @@ } | ||
for (const token of res.tokens) { | ||
// Opinionated take: if a token is scope-less, chances are we don't care about it. | ||
const codeToken = code.slice(linePtr + token.startIndex, linePtr + token.endIndex); | ||
// Opinionated take: if a token is scope-less and void, chances are we don't care about it. | ||
// Ditching it allows us to reduce complexity from the state machine's POV. | ||
if (token.scopes.length !== 1) { | ||
const codeToken = code.slice(linePtr + token.startIndex, linePtr + token.endIndex); | ||
if (token.scopes.length !== 1 || codeToken.trim()) { | ||
tokens.push({ | ||
@@ -69,0 +74,0 @@ type: token.scopes[token.scopes.length - 1], |
@@ -35,2 +35,6 @@ import { relative } from 'path'; | ||
}, | ||
W_VUE_SETUP_IS_A_REFERENCE: { | ||
name: 'Vue setup function is a reference', | ||
description: 'The setup function must be directly defined on-site, and not be a reference to a previously defined function.', | ||
}, | ||
}; | ||
@@ -37,0 +41,0 @@ /** |
@@ -0,1 +1,2 @@ | ||
import { fileURLToPath } from 'url'; | ||
import { resolve, extname } from 'path'; | ||
@@ -36,7 +37,7 @@ import { Worker, isMainThread, parentPort } from 'worker_threads'; | ||
const worker = IS_TS_NODE | ||
? new Worker(new URL(import.meta.url).pathname.replace('.ts', '.js'), { | ||
? new Worker(fileURLToPath(new URL(import.meta.url)).replace('.ts', '.js'), { | ||
// ts-node workaround | ||
execArgv: ['--require', 'ts-node/register'], | ||
}) | ||
: new Worker(new URL(import.meta.url).pathname); | ||
: new Worker(fileURLToPath(new URL(import.meta.url))); | ||
let timeout; | ||
@@ -43,0 +44,0 @@ let currentDeferred; |
@@ -8,2 +8,4 @@ export type Key = { | ||
line: number; | ||
/** Specified when the file differs from the file being processed (sub-file) */ | ||
file?: string; | ||
}; | ||
@@ -14,3 +16,3 @@ export type Warning = { | ||
}; | ||
export type Extractor = (fileContents: string, fileName: string) => string[]; | ||
export type Extractor = (fileContents: string, fileName: string) => ExtractionResult[]; | ||
export type ExtractionResult = { | ||
@@ -17,0 +19,0 @@ keys: ExtractedKey[]; |
{ | ||
"name": "@tolgee/cli", | ||
"version": "1.1.2", | ||
"version": "1.2.0", | ||
"type": "module", | ||
@@ -35,6 +35,6 @@ "description": "A tool to interact with the Tolgee Platform through CLI", | ||
"base32-decode": "^1.0.0", | ||
"commander": "^10.0.1", | ||
"cosmiconfig": "^8.1.3", | ||
"commander": "^11.0.0", | ||
"cosmiconfig": "^8.2.0", | ||
"form-data": "^4.0.0", | ||
"glob": "^10.2.5", | ||
"glob": "^10.3.3", | ||
"json5": "^2.2.3", | ||
@@ -44,3 +44,3 @@ "undici": "^5.22.1", | ||
"vscode-textmate": "^9.0.0", | ||
"xstate": "^4.37.2", | ||
"xstate": "^4.38.1", | ||
"yauzl": "^2.10.0" | ||
@@ -51,20 +51,20 @@ }, | ||
"@semantic-release/git": "^10.0.1", | ||
"@types/jest": "^29.5.1", | ||
"@types/node": "^20.2.1", | ||
"@types/jest": "^29.5.3", | ||
"@types/node": "^20.4.5", | ||
"@types/yauzl": "^2.10.0", | ||
"@typescript-eslint/eslint-plugin": "^5.59.6", | ||
"@typescript-eslint/parser": "^5.59.6", | ||
"@typescript-eslint/eslint-plugin": "^6.2.0", | ||
"@typescript-eslint/parser": "^6.2.0", | ||
"cross-env": "^7.0.3", | ||
"eslint": "^8.40.0", | ||
"eslint-plugin-jest": "^27.2.1", | ||
"eslint-plugin-prettier": "^4.2.1", | ||
"jest": "^29.5.0", | ||
"eslint": "^8.45.0", | ||
"eslint-plugin-jest": "^27.2.3", | ||
"eslint-plugin-prettier": "^5.0.0", | ||
"jest": "^29.6.1", | ||
"js-yaml": "^4.1.0", | ||
"openapi-typescript": "^6.2.4", | ||
"prettier": "^2.8.8", | ||
"openapi-typescript": "^6.3.9", | ||
"prettier": "^3.0.0", | ||
"rimraf": "^5.0.1", | ||
"semantic-release": "^21.0.2", | ||
"ts-jest": "^29.1.0", | ||
"semantic-release": "^21.0.7", | ||
"ts-jest": "^29.1.1", | ||
"ts-node": "^10.9.1", | ||
"typescript": "^5.0.4" | ||
"typescript": "^5.1.6" | ||
}, | ||
@@ -71,0 +71,0 @@ "engines": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
55
12.24%4492
24.12%903767
-5.38%+ Added
- Removed
Updated
Updated
Updated
Updated