modernize frontend to target the same ES and TS standards as the rest of the app
This commit is contained in:
parent
0a5c9f79e5
commit
22f49db21f
21 changed files with 249 additions and 170 deletions
|
|
@ -8,6 +8,7 @@ import { walk } from '../node_modules/estree-walker/src/index.js';
|
|||
import type * as estree from 'estree';
|
||||
import type * as estreeWalker from 'estree-walker';
|
||||
import type { Plugin } from 'vite';
|
||||
import type { Identifier } from 'estree';
|
||||
|
||||
function isFalsyIdentifier(identifier: estree.Identifier): boolean {
|
||||
return identifier.name === 'undefined' || identifier.name === 'NaN';
|
||||
|
|
@ -382,7 +383,7 @@ export function unwindCssModuleClassName(ast: estree.Node): void {
|
|||
if (childNode.name !== ident) return;
|
||||
this.replace({
|
||||
type: 'Identifier',
|
||||
name: node.declarations[0].id.name,
|
||||
name: (node.declarations[0].id as Identifier).name,
|
||||
});
|
||||
},
|
||||
});
|
||||
|
|
@ -432,6 +433,7 @@ export function unwindCssModuleClassName(ast: estree.Node): void {
|
|||
type: 'ArrayExpression',
|
||||
elements: node.declarations[0].init.arguments[1].elements.slice(0, __cssModulesIndex).concat(node.declarations[0].init.arguments[1].elements.slice(__cssModulesIndex + 1)),
|
||||
}],
|
||||
optional: false,
|
||||
},
|
||||
}],
|
||||
kind: 'const',
|
||||
|
|
|
|||
|
|
@ -3,12 +3,10 @@
|
|||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
/// <reference lib="esnext" />
|
||||
|
||||
import { parse as vueSfcParse } from 'vue/compiler-sfc';
|
||||
import {
|
||||
createLogger,
|
||||
EnvironmentModuleGraph,
|
||||
type EnvironmentModuleGraph,
|
||||
type LogErrorOptions,
|
||||
type LogOptions,
|
||||
normalizePath,
|
||||
|
|
@ -20,7 +18,7 @@ import { glob } from 'glob';
|
|||
import JSON5 from 'json5';
|
||||
import MagicString, { SourceMap } from 'magic-string';
|
||||
import path from 'node:path'
|
||||
import { hash, toBase62 } from '../vite.config';
|
||||
import { hash, toBase62 } from '../vite.config.js';
|
||||
import { minimatch } from 'minimatch';
|
||||
import {
|
||||
type AttributeNode,
|
||||
|
|
@ -63,7 +61,7 @@ interface MarkerRelation {
|
|||
let logger = {
|
||||
info: (msg: string, options?: LogOptions) => { },
|
||||
warn: (msg: string, options?: LogOptions) => { },
|
||||
error: (msg: string, options?: LogErrorOptions | unknown) => { },
|
||||
error: (msg: string, options?: LogErrorOptions) => { },
|
||||
};
|
||||
let loggerInitialized = false;
|
||||
|
||||
|
|
@ -470,7 +468,11 @@ export function collectFileMarkers(id: string, code: string): SearchIndexItem[]
|
|||
|
||||
return extractUsageInfoFromTemplateAst(descriptor.template?.ast, id);
|
||||
} catch (error) {
|
||||
logger.error(`Error analyzing file ${id}:`, error);
|
||||
logger.error(`Error analyzing file ${id}:`, {
|
||||
error: error instanceof Error
|
||||
? error
|
||||
: new Error(`Unknown error of type ${typeof(error)}`, { cause: error }),
|
||||
});
|
||||
}
|
||||
|
||||
return [];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue