@voltiso/transform
Advanced tools
Comparing version 3.0.6 to 3.0.7
@@ -90,2 +90,3 @@ "use strict"; | ||
} | ||
// | ||
const importTypeNodes = (0, collectNodesOfKind_1.collectNodesOfKind)(newNode, ts.SyntaxKind.ImportType); | ||
@@ -106,3 +107,15 @@ let containsImportAbsolutePath = false; | ||
} | ||
const canBeInlined = !hasSymbolsOutOfScope && !containsImportAbsolutePath; | ||
// | ||
const typeQueryNodes = (0, collectNodesOfKind_1.collectNodesOfKind)(newNode, ts.SyntaxKind.TypeQuery); | ||
const containsTypeQueryNodes = typeQueryNodes.length > 0; | ||
if (options?.warn && containsTypeQueryNodes) { | ||
const message = `\n[@voltiso/transform] unable to inline ${(0, transform_lib_1.getNodeText)(ctx, node) || (0, transform_lib_1.stringFromSyntaxKind)(node.kind)} - resulting node text would include type query node (typeof) \n @ ${(0, transform_lib_1.getNodePositionStr)(node)}`; | ||
// eslint-disable-next-line no-console | ||
console.warn(chalk_1.default.bgRed(message)); | ||
if (ctx.options.onInlineError === 'fail') | ||
throw new Error(message); | ||
} | ||
const canBeInlined = !hasSymbolsOutOfScope && | ||
!containsImportAbsolutePath && | ||
!containsTypeQueryNodes; | ||
return canBeInlined; | ||
@@ -109,0 +122,0 @@ } |
@@ -61,2 +61,3 @@ // ⠀ⓥ 2023 🌩 🌩 ⠀ ⠀ | ||
} | ||
// | ||
const importTypeNodes = collectNodesOfKind(newNode, ts.SyntaxKind.ImportType); | ||
@@ -77,5 +78,17 @@ let containsImportAbsolutePath = false; | ||
} | ||
const canBeInlined = !hasSymbolsOutOfScope && !containsImportAbsolutePath; | ||
// | ||
const typeQueryNodes = collectNodesOfKind(newNode, ts.SyntaxKind.TypeQuery); | ||
const containsTypeQueryNodes = typeQueryNodes.length > 0; | ||
if (options?.warn && containsTypeQueryNodes) { | ||
const message = `\n[@voltiso/transform] unable to inline ${getNodeText(ctx, node) || stringFromSyntaxKind(node.kind)} - resulting node text would include type query node (typeof) \n @ ${getNodePositionStr(node)}`; | ||
// eslint-disable-next-line no-console | ||
console.warn(chalk.bgRed(message)); | ||
if (ctx.options.onInlineError === 'fail') | ||
throw new Error(message); | ||
} | ||
const canBeInlined = !hasSymbolsOutOfScope && | ||
!containsImportAbsolutePath && | ||
!containsTypeQueryNodes; | ||
return canBeInlined; | ||
} | ||
//# sourceMappingURL=canBeInlined.js.map |
{ | ||
"name": "@voltiso/transform", | ||
"version": "3.0.6", | ||
"version": "3.0.7", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "repository": "git://github.com/voltiso/mono.git", |
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
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
222781
2751