@marko/babel-utils
Advanced tools
Comparing version 5.22.0 to 5.22.1
@@ -27,10 +27,34 @@ "use strict";exports.__esModule = true;exports.DiagnosticType = void 0;exports.diagnosticDeprecate = diagnosticDeprecate;exports.diagnosticError = diagnosticError;exports.diagnosticSuggest = diagnosticSuggest;exports.diagnosticWarn = diagnosticWarn;const DiagnosticType = { | ||
const { diagnostics } = file.metadata.marko; | ||
const { label, fix, loc = path.node.loc } = options; | ||
diagnostics.push({ type, label, loc, fix }); | ||
const { label, fix: rawFix, loc = path.node.loc } = options; | ||
let fix = false; | ||
if (fix && file.___compileStage !== "migrate") { | ||
throw new Error( | ||
"Diagnostic fixes can only be registered during the migrate stage."); | ||
if (rawFix) { | ||
if (file.___compileStage !== "migrate") { | ||
throw new Error( | ||
"Diagnostic fixes can only be registered during the migrate stage."); | ||
} | ||
const { applyFixes } = file.markoOpts; | ||
let apply; | ||
if (typeof rawFix === "function") { | ||
apply = rawFix; | ||
fix = true; | ||
} else { | ||
// strip off the apply function. | ||
({ apply, ...fix } = rawFix); | ||
} | ||
if (applyFixes) { | ||
const i = diagnostics.length; | ||
if (applyFixes.has(i)) { | ||
apply(applyFixes.get(i)); | ||
} | ||
} else { | ||
apply(undefined); | ||
} | ||
} | ||
diagnostics.push({ type, label, loc, fix }); | ||
} |
@@ -194,3 +194,5 @@ import type { types as t } from "@marko/compiler"; | ||
export function getArgOrSequence(path: t.NodePath<t.MarkoTag>): t.Expression; | ||
export function getArgOrSequence( | ||
path: t.NodePath<t.MarkoTag | t.MarkoAttribute> | ||
): t.Expression; | ||
@@ -197,0 +199,0 @@ export function loadFileForTag( |
{ | ||
"name": "@marko/babel-utils", | ||
"description": "Utilities for use with Marko babel plugins.", | ||
"version": "5.22.0", | ||
"version": "5.22.1", | ||
"author": "Dylan Piercey <dpiercey@ebay.com>", | ||
@@ -13,3 +13,3 @@ "bugs": "https://github.com/marko-js/marko/issues/new?template=Bug_report.md", | ||
"devDependencies": { | ||
"@marko/compiler": "^5.28.0" | ||
"@marko/compiler": "^5.28.3" | ||
}, | ||
@@ -16,0 +16,0 @@ "files": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
31245
853