fix: maybe

This commit is contained in:
2023-11-17 13:22:28 +00:00
parent b625ccd8d6
commit 999b1ae6fc
772 changed files with 3923 additions and 30947 deletions

View File

@ -82,7 +82,6 @@ function createSourceMapChain({ filename, content, compilerOptions, }) {
function injectVarsToCode({ content, markup, filename, attributes, sourceMapChain, }) {
if (!markup)
return content;
// @ts-ignore different in Svelte 5
const { vars } = (0, compiler_1.compile)((0, markup_1.stripTags)(markup), {
generate: false,
varsReport: 'full',
@ -324,11 +323,9 @@ const transformer = async ({ content, filename, markup, options = {}, attributes
filename = (0, path_1.isAbsolute)(filename) ? filename : (0, path_1.resolve)(basePath, filename);
const compilerOptions = getCompilerOptions({ filename, options, basePath });
const versionParts = package_json_1.default.version.split('.');
const canUseMixedImportsTranspiler = +versionParts[0] === 4 ||
(+versionParts[0] === 3 && +versionParts[1] >= 39);
const canUseMixedImportsTranspiler = +versionParts[0] > 3 || (+versionParts[0] === 3 && +versionParts[1] >= 39);
if (!canUseMixedImportsTranspiler && options.handleMixedImports) {
throw new Error('You need at least Svelte 3.39 and at most Svelte 4.x to use the handleMixedImports option. ' +
'The option is no longer available for Svelte 5 and beyond. Use the verbatimModuleSyntax TypeScript option instead.');
throw new Error('You need at least Svelte 3.39 to use the handleMixedImports option');
}
const handleMixedImports = !compilerOptions.preserveValueImports &&
!compilerOptions.verbatimModuleSyntax &&

View File

@ -9,7 +9,7 @@ export type TransformerArgs<T> = {
attributes?: Record<string, any>;
map?: string | object;
markup?: string;
diagnostics?: unknown[];
dianostics?: unknown[];
options?: T;
};
/**