Skip to content

Commit 77252fd

Browse files
committed
feat(compiler): add ReplexicaSkipScope implementation
1 parent f8f3041 commit 77252fd

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

  • packages/compiler/src/compiler/scope
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import * as t from '@babel/types';
2+
import { NodePath } from '@babel/core';
3+
import { IReplexicaScope } from "./types";
4+
import { attributeExists } from '../../utils/ast';
5+
import { ReplexicaScopeData } from '../types';
6+
7+
export class ReplexicaSkipScope implements IReplexicaScope {
8+
public get id(): string {
9+
throw new Error('Method not implemented.');
10+
}
11+
12+
public static fromNode(path: NodePath<t.Node>): IReplexicaScope[] {
13+
const result: IReplexicaScope[] = [];
14+
15+
if (!path.isJSXElement()) { return result; }
16+
17+
const skipRequired = attributeExists(path, 'data-replexica-skip');
18+
if (skipRequired) {
19+
throw 'skip';
20+
}
21+
22+
return result;
23+
}
24+
25+
public injectIntl(): ReplexicaScopeData {
26+
return {};
27+
}
28+
29+
public extractHints(): any[] {
30+
return [];
31+
}
32+
}

0 commit comments

Comments
 (0)