Skip to content

Commit

Permalink
feat(ivy): i18n - inlining WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
petebacondarwin committed Aug 16, 2019
1 parent d4471d9 commit 9aa8438
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
5 changes: 2 additions & 3 deletions packages/localize/inlining/src/babel/es2015-plugin.ts
Expand Up @@ -5,12 +5,11 @@
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {PluginObj} from 'babel__core';
import {buildLocalizeReplacement, convertTemplateElementToLiteral, isGlobalIdentifier, isLocalizeTag} from './shares';

export const es2015Plugin: PluginObj = {
export const es2015Plugin = {
visitor: {
TaggedTemplateExpression(path) {
TaggedTemplateExpression(path: any) {
const tag = path.get('tag');
if (isLocalizeTag(tag) && isGlobalIdentifier(tag)) {
const messageParts = path.node.quasi.quasis.map(convertTemplateElementToLiteral);
Expand Down
6 changes: 3 additions & 3 deletions packages/localize/inlining/src/babel/es5-plugin.ts
Expand Up @@ -5,13 +5,13 @@
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {PluginObj} from 'babel__core';

import {buildLocalizeReplacement, isExpressionArray, isGlobalIdentifier, isLocalizeTag, unwrapMessageParts} from './shares';

export const es5Plugin: PluginObj = {
export const es5Plugin = {
visitor: {

CallExpression(callPath) {
CallExpression(callPath: any) {
const calleePath = callPath.get('callee');
if (isLocalizeTag(calleePath) && isGlobalIdentifier(calleePath)) {
const messagePartsArg = unwrapMessageParts(callPath.node.arguments[0]);
Expand Down
2 changes: 1 addition & 1 deletion packages/localize/inlining/src/babel/shares.ts
Expand Up @@ -5,8 +5,8 @@
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {NodePath} from '@babel/core';
import * as t from '@babel/types';
import {NodePath} from 'babel__core';

export function isLocalizeTag(expression: NodePath<t.Expression>):
expression is NodePath<t.Identifier> {
Expand Down

0 comments on commit 9aa8438

Please sign in to comment.