@babel/template
Advanced tools
Comparing version 8.0.0-alpha.11 to 8.0.0-alpha.12
@@ -60,7 +60,7 @@ import * as _babel_types from '@babel/types'; | ||
declare const _default: TemplateBuilder<_babel_types.Statement | _babel_types.Statement[]> & { | ||
smart: TemplateBuilder<_babel_types.Statement | _babel_types.Statement[]>; | ||
statement: TemplateBuilder<_babel_types.Statement>; | ||
statements: TemplateBuilder<_babel_types.Statement[]>; | ||
expression: TemplateBuilder<_babel_types.Expression>; | ||
program: TemplateBuilder<_babel_types.Program>; | ||
smart: typeof smart; | ||
statement: typeof statement; | ||
statements: typeof statements; | ||
expression: typeof expression; | ||
program: typeof program; | ||
} & { | ||
@@ -74,3 +74,3 @@ smart: TemplateBuilder<_babel_types.Statement | _babel_types.Statement[]>; | ||
(tpl: string, opts?: PublicOpts): _babel_types.Statement | _babel_types.Statement[]; | ||
(tpl: TemplateStringsArray, ...args: unknown[]): _babel_types.Statement | _babel_types.Statement[]; | ||
(tpl: TemplateStringsArray, ...args: Array<unknown>): _babel_types.Statement | _babel_types.Statement[]; | ||
}; | ||
@@ -77,0 +77,0 @@ }; |
@@ -376,5 +376,20 @@ import * as _t from '@babel/types'; | ||
} | ||
function set(parent, key, value) { | ||
const node = parent[key]; | ||
parent[key] = value; | ||
if (node.type === "Identifier") { | ||
if (node.typeAnnotation) { | ||
value.typeAnnotation = node.typeAnnotation; | ||
} | ||
if (node.optional) { | ||
value.optional = node.optional; | ||
} | ||
if (node.decorators) { | ||
value.decorators = node.decorators; | ||
} | ||
} | ||
} | ||
if (index === undefined) { | ||
validate(parent, key, replacement); | ||
parent[key] = replacement; | ||
set(parent, key, replacement); | ||
} else { | ||
@@ -388,6 +403,6 @@ const items = parent[key].slice(); | ||
} else { | ||
items[index] = replacement; | ||
set(items, index, replacement); | ||
} | ||
} else { | ||
items[index] = replacement; | ||
set(items, index, replacement); | ||
} | ||
@@ -394,0 +409,0 @@ validate(parent, key, items); |
{ | ||
"name": "@babel/template", | ||
"version": "8.0.0-alpha.11", | ||
"version": "8.0.0-alpha.12", | ||
"description": "Generate an AST from a string template.", | ||
@@ -19,5 +19,5 @@ "author": "The Babel Team (https://babel.dev/team)", | ||
"dependencies": { | ||
"@babel/code-frame": "^8.0.0-alpha.11", | ||
"@babel/parser": "^8.0.0-alpha.11", | ||
"@babel/types": "^8.0.0-alpha.11" | ||
"@babel/code-frame": "^8.0.0-alpha.12", | ||
"@babel/parser": "^8.0.0-alpha.12", | ||
"@babel/types": "^8.0.0-alpha.12" | ||
}, | ||
@@ -24,0 +24,0 @@ "engines": { |
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
70968
618