Add parser support for placeholders (#9364)

This commit is contained in:
Nicolò Ribaudo 2019-03-05 00:45:42 +01:00 committed by GitHub
parent c60c4dd375
commit d832c0f434
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
141 changed files with 7630 additions and 36 deletions

View File

@ -1048,19 +1048,8 @@ export default class ExpressionParser extends LValParser {
if (isPrivate) {
this.expectOnePlugin(["classPrivateProperties", "classPrivateMethods"]);
const node = this.startNode();
const columnHashEnd = this.state.end;
this.next();
const columnIdentifierStart = this.state.start;
const spacesBetweenHashAndIdentifier =
columnIdentifierStart - columnHashEnd;
if (spacesBetweenHashAndIdentifier != 0) {
this.raise(
columnIdentifierStart,
"Unexpected space between # and identifier",
);
}
this.assertNoSpace("Unexpected space between # and identifier");
node.id = this.parseIdentifier(true);
return this.finishNode(node, "PrivateName");
} else {

View File

@ -416,15 +416,24 @@ export default class StatementParser extends ExpressionParser {
if (this.isLineTerminator()) {
node.label = null;
} else if (!this.match(tt.name)) {
this.unexpected();
} else {
node.label = this.parseIdentifier();
this.semicolon();
}
// Verify that there is an actual destination to break or
// continue to.
this.verifyBreakContinue(node, keyword);
return this.finishNode(
node,
isBreak ? "BreakStatement" : "ContinueStatement",
);
}
verifyBreakContinue(
node: N.BreakStatement | N.ContinueStatement,
keyword: string,
) {
const isBreak = keyword === "break";
let i;
for (i = 0; i < this.state.labels.length; ++i) {
const lab = this.state.labels[i];
@ -436,10 +445,6 @@ export default class StatementParser extends ExpressionParser {
if (i === this.state.labels.length) {
this.raise(node.start, "Unsyntactic " + keyword);
}
return this.finishNode(
node,
isBreak ? "BreakStatement" : "ContinueStatement",
);
}
parseDebuggerStatement(node: N.DebuggerStatement): N.DebuggerStatement {
@ -800,7 +805,7 @@ export default class StatementParser extends ExpressionParser {
parseExpressionStatement(
node: N.ExpressionStatement,
expr: N.Expression,
): N.ExpressionStatement {
): N.Statement {
node.expression = expr;
this.semicolon();
return this.finishNode(node, "ExpressionStatement");
@ -1024,6 +1029,7 @@ export default class StatementParser extends ExpressionParser {
): T {
const isStatement = statement & FUNC_STATEMENT;
const isHangingStatement = statement & FUNC_HANGING_STATEMENT;
const requireId = !!isStatement && !(statement & FUNC_NULLABLE_ID);
this.initFunction(node, isAsync);
@ -1036,10 +1042,7 @@ export default class StatementParser extends ExpressionParser {
node.generator = this.eat(tt.star);
if (isStatement) {
node.id =
statement & FUNC_NULLABLE_ID && !this.match(tt.name)
? null
: this.parseIdentifier();
node.id = this.parseFunctionId(requireId);
if (node.id && !isHangingStatement) {
// If it is a regular function declaration in sloppy mode, then it is
// subject to Annex B semantics (BIND_FUNCTION). Otherwise, the binding
@ -1067,7 +1070,7 @@ export default class StatementParser extends ExpressionParser {
this.scope.enter(functionFlags(node.async, node.generator));
if (!isStatement) {
node.id = this.match(tt.name) ? this.parseIdentifier() : null;
node.id = this.parseFunctionId();
}
this.parseFunctionParams(node);
@ -1090,6 +1093,10 @@ export default class StatementParser extends ExpressionParser {
return node;
}
parseFunctionId(requireId?: boolean): ?N.Identifier {
return requireId || this.match(tt.name) ? this.parseIdentifier() : null;
}
parseFunctionParams(node: N.Function, allowModifiers?: boolean): void {
const oldInParameters = this.state.inParameters;
this.state.inParameters = true;
@ -1122,7 +1129,7 @@ export default class StatementParser extends ExpressionParser {
this.parseClassId(node, isStatement, optionalId);
this.parseClassSuper(node);
this.parseClassBody(node);
node.body = this.parseClassBody(!!node.superClass);
this.state.strict = oldStrict;
@ -1149,7 +1156,7 @@ export default class StatementParser extends ExpressionParser {
);
}
parseClassBody(node: N.Class): void {
parseClassBody(constructorAllowsSuper: boolean): N.ClassBody {
this.state.classLevel++;
const state = { hadConstructor: false };
@ -1159,8 +1166,6 @@ export default class StatementParser extends ExpressionParser {
this.expect(tt.braceL);
const constructorAllowsSuper = node.superClass !== null;
// For the smartPipelines plugin: Disable topic references from outer
// contexts within the class body. They are permitted in test expressions,
// outside of the class body.
@ -1212,9 +1217,9 @@ export default class StatementParser extends ExpressionParser {
);
}
node.body = this.finishNode(classBody, "ClassBody");
this.state.classLevel--;
return this.finishNode(classBody, "ClassBody");
}
parseClassMember(

View File

@ -113,6 +113,13 @@ export default class UtilParser extends Tokenizer {
this.eat(type) || this.unexpected(pos, type);
}
// Throws if the current token and the prev one are separated by a space.
assertNoSpace(message: string = "Unexpected space."): void {
if (this.state.start > this.state.lastTokEnd) {
this.raise(this.state.lastTokEnd, message);
}
}
// Raise an unexpected token error. Can take the expected token type
// instead of a message string.

View File

@ -88,12 +88,17 @@ import estree from "./plugins/estree";
import flow from "./plugins/flow";
import jsx from "./plugins/jsx";
import typescript from "./plugins/typescript";
import placeholders from "./plugins/placeholders";
// NOTE: estree must load first; flow and typescript must load last.
export const mixinPluginNames = ["estree", "jsx", "flow", "typescript"];
// NOTE: order is important. estree must come first; placeholders must come last.
export const mixinPlugins: { [name: string]: MixinPlugin } = {
estree,
jsx,
flow,
typescript,
placeholders,
};
export const mixinPluginNames: $ReadOnlyArray<string> = Object.keys(
mixinPlugins,
);

View File

@ -0,0 +1,315 @@
// @flow
import * as charCodes from "charcodes";
import { types as tt, TokenType } from "../tokenizer/types";
import type Parser from "../parser";
import * as N from "../types";
tt.placeholder = new TokenType("%%", { startsExpr: true });
export type PlaceholderTypes =
| "Identifier"
| "StringLiteral"
| "Expression"
| "Statement"
| "Declaration"
| "BlockStatement"
| "ClassBody"
| "Pattern";
// $PropertyType doesn't support enums. Use a fake "switch" (GetPlaceholderNode)
//type MaybePlaceholder<T: PlaceholderTypes> = $PropertyType<N, T> | N.Placeholder<T>;
type _Switch<Value, Cases, Index> = $Call<
(
$ElementType<$ElementType<Cases, Index>, 0>,
) => $ElementType<$ElementType<Cases, Index>, 1>,
Value,
>;
type $Switch<Value, Cases> = _Switch<Value, Cases, *>;
type NodeOf<T: PlaceholderTypes> = $Switch<
T,
[
["Identifier", N.Identifier],
["StringLiteral", N.StringLiteral],
["Expression", N.Expression],
["Statement", N.Statement],
["Declaration", N.Declaration],
["BlockStatement", N.BlockStatement],
["ClassBody", N.ClassBody],
["Pattern", N.Pattern],
],
>;
// Placeholder<T> breaks everything, because its type is incompatible with
// the substituted nodes.
type MaybePlaceholder<T: PlaceholderTypes> = NodeOf<T>; // | Placeholder<T>
export default (superClass: Class<Parser>): Class<Parser> =>
class extends superClass {
parsePlaceholder<T: PlaceholderTypes>(
expectedNode: T,
): /*?N.Placeholder<T>*/ ?MaybePlaceholder<T> {
if (this.match(tt.placeholder)) {
const node = this.startNode();
this.next();
this.assertNoSpace("Unexpected space in placeholder.");
// We can't use this.parseIdentifier because
// we don't want nested placeholders.
node.name = super.parseIdentifier(/* liberal */ true);
this.assertNoSpace("Unexpected space in placeholder.");
this.expect(tt.placeholder);
return this.finishPlaceholder(node, expectedNode);
}
}
finishPlaceholder<T: PlaceholderTypes>(
node: N.Node,
expectedNode: T,
): /*N.Placeholder<T>*/ MaybePlaceholder<T> {
node.expectedNode = expectedNode;
return this.finishNode(node, "Placeholder");
}
/* ============================================================ *
* tokenizer/index.js *
* ============================================================ */
getTokenFromCode(code: number) {
if (
code === charCodes.percentSign &&
this.state.input.charCodeAt(this.state.pos + 1) ===
charCodes.percentSign
) {
return this.finishOp(tt.placeholder, 2);
}
return super.getTokenFromCode(...arguments);
}
/* ============================================================ *
* parser/expression.js *
* ============================================================ */
parseExprAtom(): MaybePlaceholder<"Expression"> {
return (
this.parsePlaceholder("Expression") || super.parseExprAtom(...arguments)
);
}
parseIdentifier(): MaybePlaceholder<"Identifier"> {
// NOTE: This function only handles identifiers outside of
// expressions and binding patterns, since they are already
// handled by the parseExprAtom and parseBindingAtom functions.
// This is needed, for example, to parse "class %%NAME%% {}".
return (
this.parsePlaceholder("Identifier") ||
super.parseIdentifier(...arguments)
);
}
checkReservedWord(word: string): void {
// Sometimes we call #checkReservedWord(node.name), expecting
// that node is an Identifier. If it is a Placeholder, name
// will be undefined.
if (word !== undefined) super.checkReservedWord(...arguments);
}
/* ============================================================ *
* parser/lval.js *
* ============================================================ */
parseBindingAtom(): MaybePlaceholder<"Pattern"> {
return (
this.parsePlaceholder("Pattern") || super.parseBindingAtom(...arguments)
);
}
checkLVal(expr: N.Expression): void {
if (expr.type !== "Placeholder") super.checkLVal(...arguments);
}
toAssignable(node: N.Node): N.Node {
if (
node &&
node.type === "Placeholder" &&
node.expectedNode === "Expression"
) {
node.expectedNode = "Pattern";
return node;
}
return super.toAssignable(...arguments);
}
/* ============================================================ *
* parser/statement.js *
* ============================================================ */
verifyBreakContinue(node: N.BreakStatement | N.ContinueStatement) {
if (node.label && node.label.type === "Placeholder") return;
super.verifyBreakContinue(...arguments);
}
parseExpressionStatement(
node: MaybePlaceholder<"Statement">,
expr: N.Expression,
): MaybePlaceholder<"Statement"> {
if (
expr.type !== "Placeholder" ||
(expr.extra && expr.extra.parenthesized)
) {
return super.parseExpressionStatement(...arguments);
}
if (this.match(tt.colon)) {
const stmt: N.LabeledStatement = node;
stmt.label = this.finishPlaceholder(expr, "Identifier");
this.next();
stmt.body = this.parseStatement("label");
return this.finishNode(stmt, "LabeledStatement");
}
this.semicolon();
node.name = expr.name;
return this.finishPlaceholder(node, "Statement");
}
parseBlock(): MaybePlaceholder<"BlockStatement"> {
return (
this.parsePlaceholder("BlockStatement") ||
super.parseBlock(...arguments)
);
}
parseFunctionId(): ?MaybePlaceholder<"Identifier"> {
return (
this.parsePlaceholder("Identifier") ||
super.parseFunctionId(...arguments)
);
}
parseClass<T: N.Class>(
node: T,
isStatement: /* T === ClassDeclaration */ boolean,
optionalId?: boolean,
): T {
const type = isStatement ? "ClassDeclaration" : "ClassExpression";
this.next();
this.takeDecorators(node);
const placeholder = this.parsePlaceholder("Identifier");
if (placeholder) {
if (
this.match(tt._extends) ||
this.match(tt.placeholder) ||
this.match(tt.braceL)
) {
node.id = placeholder;
} else if (optionalId || !isStatement) {
node.id = null;
node.body = this.finishPlaceholder(placeholder, "ClassBody");
return this.finishNode(node, type);
} else {
this.unexpected(null, "A class name is required");
}
} else {
this.parseClassId(node, isStatement, optionalId);
}
this.parseClassSuper(node);
node.body =
this.parsePlaceholder("ClassBody") ||
this.parseClassBody(!!node.superClass);
return this.finishNode(node, type);
}
parseExport(node: N.Node): N.Node {
const placeholder = this.parsePlaceholder("Identifier");
if (!placeholder) return super.parseExport(...arguments);
if (!this.isContextual("from") && !this.match(tt.comma)) {
// export %%DECL%%;
node.specifiers = [];
node.source = null;
node.declaration = this.finishPlaceholder(placeholder, "Declaration");
return this.finishNode(node, "ExportNamedDeclaration");
}
// export %%NAME%% from "foo";
this.expectPlugin("exportDefaultFrom");
const specifier = this.startNode();
specifier.exported = placeholder;
node.specifiers = [this.finishNode(specifier, "ExportDefaultSpecifier")];
return super.parseExport(node);
}
maybeParseExportDefaultSpecifier(node: N.Node): boolean {
if (node.specifiers && node.specifiers.length > 0) {
// "export %%NAME%%" has already been parsed by #parseExport.
return true;
}
return super.maybeParseExportDefaultSpecifier(...arguments);
}
checkExport(node: N.ExportNamedDeclaration): void {
const { specifiers } = node;
if (specifiers && specifiers.length) {
node.specifiers = specifiers.filter(
node => node.exported.type === "Placeholder",
);
}
super.checkExport(node);
node.specifiers = specifiers;
}
parseImport(
node: N.Node,
): N.ImportDeclaration | N.TsImportEqualsDeclaration {
const placeholder = this.parsePlaceholder("Identifier");
if (!placeholder) return super.parseImport(...arguments);
node.specifiers = [];
if (!this.isContextual("from") && !this.match(tt.comma)) {
// import %%STRING%%;
node.source = this.finishPlaceholder(placeholder, "StringLiteral");
this.semicolon();
return this.finishNode(node, "ImportDeclaration");
}
// import %%DEFAULT%% ...
const specifier = this.startNodeAtNode(placeholder);
specifier.local = placeholder;
this.finishNode(specifier, "ImportDefaultSpecifier");
node.specifiers.push(specifier);
if (this.eat(tt.comma)) {
// import %%DEFAULT%%, * as ...
const hasStarImport = this.maybeParseStarImportSpecifier(node);
// import %%DEFAULT%%, { ...
if (!hasStarImport) this.parseNamedImportSpecifiers(node);
}
this.expectContextual("from");
node.source = this.parseImportSource();
this.semicolon();
return this.finishNode(node, "ImportDeclaration");
}
parseImportSource(): MaybePlaceholder<"StringLiteral"> {
// import ... from %%STRING%%;
return (
this.parsePlaceholder("StringLiteral") ||
super.parseImportSource(...arguments)
);
}
};

View File

@ -3,6 +3,7 @@
import type { SourceType } from "./options";
import type { Token } from "./tokenizer";
import type { SourceLocation } from "./util/location";
import type { PlaceholderTypes } from "./plugins/placeholders";
/*
* If making any changes to the AST, update:
@ -45,6 +46,7 @@ export type Pattern =
| ArrayPattern
| RestElement
| AssignmentPattern;
//| Placeholder<"Pattern">;
export type Declaration =
| VariableDeclaration
| ClassDeclaration
@ -53,6 +55,8 @@ export type Declaration =
| TsTypeAliasDeclaration
| TsEnumDeclaration
| TsModuleDeclaration;
// | Placeholder<"Declaration">;
export type DeclarationBase = NodeBase & {
// TypeScript allows declarations to be prefixed by `declare`.
//TODO: a FunctionDeclaration is never "declare", because it's a TSDeclareFunction instead.
@ -78,6 +82,7 @@ export type Identifier = PatternBase & {
// TypeScript only. Used in case of an optional parameter.
optional?: ?true,
};
// | Placeholder<"Identifier">;
export type PrivateName = NodeBase & {
type: "PrivateName",
@ -188,6 +193,7 @@ export type BlockStatement = NodeBase & {
body: Array<Statement>, // TODO: $ReadOnlyArray
directives: $ReadOnlyArray<Directive>,
};
// | Placeholder<"BlockStatement">;
export type EmptyStatement = NodeBase & {
type: "EmptyStatement",
@ -682,6 +688,7 @@ export type ClassBody = NodeBase & {
type: "ClassBody",
body: Array<ClassMember | TsIndexSignature>, // TODO: $ReadOnlyArray
};
// | Placeholder<"ClassBody">;
export type ClassMemberBase = NodeBase &
HasDecorators & {
@ -1421,6 +1428,16 @@ export type TsNonNullExpression = NodeBase & {
expression: Expression,
};
// ================
// Babel placeholders %%foo%%
// ================
export type Placeholder<N: PlaceholderTypes> = NodeBase & {
type: "Placeholder",
id: Identifier,
expectedNode: N,
};
// ================
// Other
// ================

View File

@ -1,4 +1,4 @@
{
"throws": "Unexpected space between # and identifier (2:5)",
"throws": "Unexpected space between # and identifier (2:3)",
"plugins": ["classPrivateMethods"]
}

View File

@ -1,4 +1,4 @@
{
"throws": "Unexpected space between # and identifier (2:5)",
"throws": "Unexpected space between # and identifier (2:3)",
"plugins": ["classPrivateMethods"]
}

View File

@ -0,0 +1 @@
%%FOO%%

View File

@ -0,0 +1,4 @@
{
"plugins": [],
"throws": "Unexpected token (1:0)"
}

View File

@ -0,0 +1 @@
%%FOO %%

View File

@ -0,0 +1,4 @@
{
"plugins": ["placeholders"],
"throws": "Unexpected space in placeholder. (1:5)"
}

View File

@ -0,0 +1 @@
%% FOO%%

View File

@ -0,0 +1,4 @@
{
"plugins": ["placeholders"],
"throws": "Unexpected space in placeholder. (1:2)"
}

View File

@ -0,0 +1 @@
async %%PARAM%% => %%BODY%%;

View File

@ -0,0 +1,4 @@
{
"plugins": ["placeholders"],
"throws": "Unexpected token, expected \";\" (1:6)"
}

View File

@ -0,0 +1 @@
async (%%PARAM%%) => %%BODY%%;

View File

@ -0,0 +1,136 @@
{
"type": "File",
"start": 0,
"end": 30,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 30
}
},
"program": {
"type": "Program",
"start": 0,
"end": 30,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 30
}
},
"sourceType": "script",
"interpreter": null,
"body": [
{
"type": "ExpressionStatement",
"start": 0,
"end": 30,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 30
}
},
"expression": {
"type": "ArrowFunctionExpression",
"start": 0,
"end": 29,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 29
}
},
"id": null,
"generator": false,
"async": true,
"params": [
{
"type": "Placeholder",
"start": 7,
"end": 16,
"loc": {
"start": {
"line": 1,
"column": 7
},
"end": {
"line": 1,
"column": 16
}
},
"name": {
"type": "Identifier",
"start": 9,
"end": 14,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 14
},
"identifierName": "PARAM"
},
"name": "PARAM"
},
"expectedNode": "Pattern"
}
],
"body": {
"type": "Placeholder",
"start": 21,
"end": 29,
"loc": {
"start": {
"line": 1,
"column": 21
},
"end": {
"line": 1,
"column": 29
}
},
"name": {
"type": "Identifier",
"start": 23,
"end": 27,
"loc": {
"start": {
"line": 1,
"column": 23
},
"end": {
"line": 1,
"column": 27
},
"identifierName": "BODY"
},
"name": "BODY"
},
"expectedNode": "Expression"
}
}
}
],
"directives": []
}
}

View File

@ -0,0 +1 @@
%%PARAM%% => %%BODY%%;

View File

@ -0,0 +1,4 @@
{
"plugins": ["placeholders"],
"throws": "Unexpected token, expected \";\" (1:10)"
}

View File

@ -0,0 +1 @@
(%%PARAM%%) => %%BODY%%;

View File

@ -0,0 +1,136 @@
{
"type": "File",
"start": 0,
"end": 24,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 24
}
},
"program": {
"type": "Program",
"start": 0,
"end": 24,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 24
}
},
"sourceType": "script",
"interpreter": null,
"body": [
{
"type": "ExpressionStatement",
"start": 0,
"end": 24,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 24
}
},
"expression": {
"type": "ArrowFunctionExpression",
"start": 0,
"end": 23,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 23
}
},
"id": null,
"generator": false,
"async": false,
"params": [
{
"type": "Placeholder",
"start": 1,
"end": 10,
"loc": {
"start": {
"line": 1,
"column": 1
},
"end": {
"line": 1,
"column": 10
}
},
"name": {
"type": "Identifier",
"start": 3,
"end": 8,
"loc": {
"start": {
"line": 1,
"column": 3
},
"end": {
"line": 1,
"column": 8
},
"identifierName": "PARAM"
},
"name": "PARAM"
},
"expectedNode": "Pattern"
}
],
"body": {
"type": "Placeholder",
"start": 15,
"end": 23,
"loc": {
"start": {
"line": 1,
"column": 15
},
"end": {
"line": 1,
"column": 23
}
},
"name": {
"type": "Identifier",
"start": 17,
"end": 21,
"loc": {
"start": {
"line": 1,
"column": 17
},
"end": {
"line": 1,
"column": 21
},
"identifierName": "BODY"
},
"name": "BODY"
},
"expectedNode": "Expression"
}
}
}
],
"directives": []
}
}

View File

@ -0,0 +1 @@
void class %%BODY%%

View File

@ -0,0 +1,116 @@
{
"type": "File",
"start": 0,
"end": 19,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 19
}
},
"program": {
"type": "Program",
"start": 0,
"end": 19,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 19
}
},
"sourceType": "script",
"interpreter": null,
"body": [
{
"type": "ExpressionStatement",
"start": 0,
"end": 19,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 19
}
},
"expression": {
"type": "UnaryExpression",
"start": 0,
"end": 19,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 19
}
},
"operator": "void",
"prefix": true,
"argument": {
"type": "ClassExpression",
"start": 5,
"end": 19,
"loc": {
"start": {
"line": 1,
"column": 5
},
"end": {
"line": 1,
"column": 19
}
},
"id": null,
"body": {
"type": "Placeholder",
"start": 11,
"end": 19,
"loc": {
"start": {
"line": 1,
"column": 11
},
"end": {
"line": 1,
"column": 19
}
},
"name": {
"type": "Identifier",
"start": 13,
"end": 17,
"loc": {
"start": {
"line": 1,
"column": 13
},
"end": {
"line": 1,
"column": 17
},
"identifierName": "BODY"
},
"name": "BODY"
},
"expectedNode": "ClassBody"
}
}
}
}
],
"directives": []
}
}

View File

@ -0,0 +1 @@
class Cl %%BODY%%

View File

@ -0,0 +1,101 @@
{
"type": "File",
"start": 0,
"end": 17,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 17
}
},
"program": {
"type": "Program",
"start": 0,
"end": 17,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 17
}
},
"sourceType": "script",
"interpreter": null,
"body": [
{
"type": "ClassDeclaration",
"start": 0,
"end": 17,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 17
}
},
"id": {
"type": "Identifier",
"start": 6,
"end": 8,
"loc": {
"start": {
"line": 1,
"column": 6
},
"end": {
"line": 1,
"column": 8
},
"identifierName": "Cl"
},
"name": "Cl"
},
"superClass": null,
"body": {
"type": "Placeholder",
"start": 9,
"end": 17,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 17
}
},
"name": {
"type": "Identifier",
"start": 11,
"end": 15,
"loc": {
"start": {
"line": 1,
"column": 11
},
"end": {
"line": 1,
"column": 15
},
"identifierName": "BODY"
},
"name": "BODY"
},
"expectedNode": "ClassBody"
}
}
],
"directives": []
}
}

View File

@ -0,0 +1,2 @@
@(%%FOO%%)
class A {}

View File

@ -0,0 +1,6 @@
{
"plugins": [
"placeholders",
["decorators", { "decoratorsBeforeExport": true }]
]
}

View File

@ -0,0 +1,134 @@
{
"type": "File",
"start": 0,
"end": 21,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 2,
"column": 10
}
},
"program": {
"type": "Program",
"start": 0,
"end": 21,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 2,
"column": 10
}
},
"sourceType": "script",
"interpreter": null,
"body": [
{
"type": "ClassDeclaration",
"start": 0,
"end": 21,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 2,
"column": 10
}
},
"decorators": [
{
"type": "Decorator",
"start": 0,
"end": 10,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 10
}
},
"expression": {
"type": "Placeholder",
"start": 2,
"end": 9,
"loc": {
"start": {
"line": 1,
"column": 2
},
"end": {
"line": 1,
"column": 9
}
},
"name": {
"type": "Identifier",
"start": 4,
"end": 7,
"loc": {
"start": {
"line": 1,
"column": 4
},
"end": {
"line": 1,
"column": 7
},
"identifierName": "FOO"
},
"name": "FOO"
},
"expectedNode": "Expression"
}
}
],
"id": {
"type": "Identifier",
"start": 17,
"end": 18,
"loc": {
"start": {
"line": 2,
"column": 6
},
"end": {
"line": 2,
"column": 7
},
"identifierName": "A"
},
"name": "A"
},
"superClass": null,
"body": {
"type": "ClassBody",
"start": 19,
"end": 21,
"loc": {
"start": {
"line": 2,
"column": 8
},
"end": {
"line": 2,
"column": 10
}
},
"body": []
}
}
],
"directives": []
}
}

View File

@ -0,0 +1 @@
class %%ID%% %%BODY%%

View File

@ -0,0 +1,117 @@
{
"type": "File",
"start": 0,
"end": 21,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 21
}
},
"program": {
"type": "Program",
"start": 0,
"end": 21,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 21
}
},
"sourceType": "script",
"interpreter": null,
"body": [
{
"type": "ClassDeclaration",
"start": 0,
"end": 21,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 21
}
},
"id": {
"type": "Placeholder",
"start": 6,
"end": 12,
"loc": {
"start": {
"line": 1,
"column": 6
},
"end": {
"line": 1,
"column": 12
}
},
"name": {
"type": "Identifier",
"start": 8,
"end": 10,
"loc": {
"start": {
"line": 1,
"column": 8
},
"end": {
"line": 1,
"column": 10
},
"identifierName": "ID"
},
"name": "ID"
},
"expectedNode": "Identifier"
},
"superClass": null,
"body": {
"type": "Placeholder",
"start": 13,
"end": 21,
"loc": {
"start": {
"line": 1,
"column": 13
},
"end": {
"line": 1,
"column": 21
}
},
"name": {
"type": "Identifier",
"start": 15,
"end": 19,
"loc": {
"start": {
"line": 1,
"column": 15
},
"end": {
"line": 1,
"column": 19
},
"identifierName": "BODY"
},
"name": "BODY"
},
"expectedNode": "ClassBody"
}
}
],
"directives": []
}
}

View File

@ -0,0 +1 @@
class %%ID%% extends %%SUPER%% %%BODY%%

View File

@ -0,0 +1,149 @@
{
"type": "File",
"start": 0,
"end": 39,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 39
}
},
"program": {
"type": "Program",
"start": 0,
"end": 39,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 39
}
},
"sourceType": "script",
"interpreter": null,
"body": [
{
"type": "ClassDeclaration",
"start": 0,
"end": 39,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 39
}
},
"id": {
"type": "Placeholder",
"start": 6,
"end": 12,
"loc": {
"start": {
"line": 1,
"column": 6
},
"end": {
"line": 1,
"column": 12
}
},
"name": {
"type": "Identifier",
"start": 8,
"end": 10,
"loc": {
"start": {
"line": 1,
"column": 8
},
"end": {
"line": 1,
"column": 10
},
"identifierName": "ID"
},
"name": "ID"
},
"expectedNode": "Identifier"
},
"superClass": {
"type": "Placeholder",
"start": 21,
"end": 30,
"loc": {
"start": {
"line": 1,
"column": 21
},
"end": {
"line": 1,
"column": 30
}
},
"name": {
"type": "Identifier",
"start": 23,
"end": 28,
"loc": {
"start": {
"line": 1,
"column": 23
},
"end": {
"line": 1,
"column": 28
},
"identifierName": "SUPER"
},
"name": "SUPER"
},
"expectedNode": "Expression"
},
"body": {
"type": "Placeholder",
"start": 31,
"end": 39,
"loc": {
"start": {
"line": 1,
"column": 31
},
"end": {
"line": 1,
"column": 39
}
},
"name": {
"type": "Identifier",
"start": 33,
"end": 37,
"loc": {
"start": {
"line": 1,
"column": 33
},
"end": {
"line": 1,
"column": 37
},
"identifierName": "BODY"
},
"name": "BODY"
},
"expectedNode": "ClassBody"
}
}
],
"directives": []
}
}

View File

@ -0,0 +1 @@
class %%ID%% extends %%SUPER%% {}

View File

@ -0,0 +1,132 @@
{
"type": "File",
"start": 0,
"end": 33,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 33
}
},
"program": {
"type": "Program",
"start": 0,
"end": 33,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 33
}
},
"sourceType": "script",
"interpreter": null,
"body": [
{
"type": "ClassDeclaration",
"start": 0,
"end": 33,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 33
}
},
"id": {
"type": "Placeholder",
"start": 6,
"end": 12,
"loc": {
"start": {
"line": 1,
"column": 6
},
"end": {
"line": 1,
"column": 12
}
},
"name": {
"type": "Identifier",
"start": 8,
"end": 10,
"loc": {
"start": {
"line": 1,
"column": 8
},
"end": {
"line": 1,
"column": 10
},
"identifierName": "ID"
},
"name": "ID"
},
"expectedNode": "Identifier"
},
"superClass": {
"type": "Placeholder",
"start": 21,
"end": 30,
"loc": {
"start": {
"line": 1,
"column": 21
},
"end": {
"line": 1,
"column": 30
}
},
"name": {
"type": "Identifier",
"start": 23,
"end": 28,
"loc": {
"start": {
"line": 1,
"column": 23
},
"end": {
"line": 1,
"column": 28
},
"identifierName": "SUPER"
},
"name": "SUPER"
},
"expectedNode": "Expression"
},
"body": {
"type": "ClassBody",
"start": 31,
"end": 33,
"loc": {
"start": {
"line": 1,
"column": 31
},
"end": {
"line": 1,
"column": 33
}
},
"body": []
}
}
],
"directives": []
}
}

View File

@ -0,0 +1 @@
void class %%ID%% {}

View File

@ -0,0 +1,132 @@
{
"type": "File",
"start": 0,
"end": 20,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 20
}
},
"program": {
"type": "Program",
"start": 0,
"end": 20,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 20
}
},
"sourceType": "script",
"interpreter": null,
"body": [
{
"type": "ExpressionStatement",
"start": 0,
"end": 20,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 20
}
},
"expression": {
"type": "UnaryExpression",
"start": 0,
"end": 20,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 20
}
},
"operator": "void",
"prefix": true,
"argument": {
"type": "ClassExpression",
"start": 5,
"end": 20,
"loc": {
"start": {
"line": 1,
"column": 5
},
"end": {
"line": 1,
"column": 20
}
},
"id": {
"type": "Placeholder",
"start": 11,
"end": 17,
"loc": {
"start": {
"line": 1,
"column": 11
},
"end": {
"line": 1,
"column": 17
}
},
"name": {
"type": "Identifier",
"start": 13,
"end": 15,
"loc": {
"start": {
"line": 1,
"column": 13
},
"end": {
"line": 1,
"column": 15
},
"identifierName": "ID"
},
"name": "ID"
},
"expectedNode": "Identifier"
},
"superClass": null,
"body": {
"type": "ClassBody",
"start": 18,
"end": 20,
"loc": {
"start": {
"line": 1,
"column": 18
},
"end": {
"line": 1,
"column": 20
}
},
"body": []
}
}
}
}
],
"directives": []
}
}

View File

@ -0,0 +1 @@
class %%ID%% {}

View File

@ -0,0 +1,100 @@
{
"type": "File",
"start": 0,
"end": 15,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 15
}
},
"program": {
"type": "Program",
"start": 0,
"end": 15,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 15
}
},
"sourceType": "script",
"interpreter": null,
"body": [
{
"type": "ClassDeclaration",
"start": 0,
"end": 15,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 15
}
},
"id": {
"type": "Placeholder",
"start": 6,
"end": 12,
"loc": {
"start": {
"line": 1,
"column": 6
},
"end": {
"line": 1,
"column": 12
}
},
"name": {
"type": "Identifier",
"start": 8,
"end": 10,
"loc": {
"start": {
"line": 1,
"column": 8
},
"end": {
"line": 1,
"column": 10
},
"identifierName": "ID"
},
"name": "ID"
},
"expectedNode": "Identifier"
},
"superClass": null,
"body": {
"type": "ClassBody",
"start": 13,
"end": 15,
"loc": {
"start": {
"line": 1,
"column": 13
},
"end": {
"line": 1,
"column": 15
}
},
"body": []
}
}
],
"directives": []
}
}

View File

@ -0,0 +1 @@
class Cl extends %%SUPER%% {}

View File

@ -0,0 +1,116 @@
{
"type": "File",
"start": 0,
"end": 29,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 29
}
},
"program": {
"type": "Program",
"start": 0,
"end": 29,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 29
}
},
"sourceType": "script",
"interpreter": null,
"body": [
{
"type": "ClassDeclaration",
"start": 0,
"end": 29,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 29
}
},
"id": {
"type": "Identifier",
"start": 6,
"end": 8,
"loc": {
"start": {
"line": 1,
"column": 6
},
"end": {
"line": 1,
"column": 8
},
"identifierName": "Cl"
},
"name": "Cl"
},
"superClass": {
"type": "Placeholder",
"start": 17,
"end": 26,
"loc": {
"start": {
"line": 1,
"column": 17
},
"end": {
"line": 1,
"column": 26
}
},
"name": {
"type": "Identifier",
"start": 19,
"end": 24,
"loc": {
"start": {
"line": 1,
"column": 19
},
"end": {
"line": 1,
"column": 24
},
"identifierName": "SUPER"
},
"name": "SUPER"
},
"expectedNode": "Expression"
},
"body": {
"type": "ClassBody",
"start": 27,
"end": 29,
"loc": {
"start": {
"line": 1,
"column": 27
},
"end": {
"line": 1,
"column": 29
}
},
"body": []
}
}
],
"directives": []
}
}

View File

@ -0,0 +1 @@
export %%DECL%%;

View File

@ -0,0 +1,100 @@
{
"type": "File",
"start": 0,
"end": 16,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 16
}
},
"program": {
"type": "Program",
"start": 0,
"end": 16,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 16
}
},
"sourceType": "module",
"interpreter": null,
"body": [
{
"type": "ExportNamedDeclaration",
"start": 0,
"end": 15,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 15
}
},
"specifiers": [],
"source": null,
"declaration": {
"type": "Placeholder",
"start": 7,
"end": 15,
"loc": {
"start": {
"line": 1,
"column": 7
},
"end": {
"line": 1,
"column": 15
}
},
"name": {
"type": "Identifier",
"start": 9,
"end": 13,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 13
},
"identifierName": "DECL"
},
"name": "DECL"
},
"expectedNode": "Declaration"
}
},
{
"type": "EmptyStatement",
"start": 15,
"end": 16,
"loc": {
"start": {
"line": 1,
"column": 15
},
"end": {
"line": 1,
"column": 16
}
}
}
],
"directives": []
}
}

View File

@ -0,0 +1 @@
export default from %%FILE%%;

View File

@ -0,0 +1,7 @@
{
"plugins": [
"placeholders"
],
"sourceType": "module",
"throws": "This experimental syntax requires enabling the parser plugin: 'exportDefaultFrom' (1:7)"
}

View File

@ -0,0 +1 @@
export %%NAME%% from "file";

View File

@ -0,0 +1,7 @@
{
"plugins": [
"placeholders"
],
"sourceType": "module",
"throws": "This experimental syntax requires enabling the parser plugin: 'exportDefaultFrom' (1:16)"
}

View File

@ -0,0 +1 @@
export %%NAME%% from %%FILE%%;

View File

@ -0,0 +1,7 @@
{
"plugins": [
"placeholders"
],
"sourceType": "module",
"throws": "This experimental syntax requires enabling the parser plugin: 'exportDefaultFrom' (1:16)"
}

View File

@ -0,0 +1 @@
export name from %%FILE%%;

View File

@ -0,0 +1,7 @@
{
"plugins": [
"placeholders"
],
"sourceType": "module",
"throws": "This experimental syntax requires enabling the parser plugin: 'exportDefaultFrom' (1:7)"
}

View File

@ -0,0 +1 @@
export { name as %%ALIAS%% };

View File

@ -0,0 +1,119 @@
{
"type": "File",
"start": 0,
"end": 29,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 29
}
},
"program": {
"type": "Program",
"start": 0,
"end": 29,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 29
}
},
"sourceType": "module",
"interpreter": null,
"body": [
{
"type": "ExportNamedDeclaration",
"start": 0,
"end": 29,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 29
}
},
"specifiers": [
{
"type": "ExportSpecifier",
"start": 9,
"end": 26,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 26
}
},
"local": {
"type": "Identifier",
"start": 9,
"end": 13,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 13
},
"identifierName": "name"
},
"name": "name"
},
"exported": {
"type": "Placeholder",
"start": 17,
"end": 26,
"loc": {
"start": {
"line": 1,
"column": 17
},
"end": {
"line": 1,
"column": 26
}
},
"name": {
"type": "Identifier",
"start": 19,
"end": 24,
"loc": {
"start": {
"line": 1,
"column": 19
},
"end": {
"line": 1,
"column": 24
},
"identifierName": "ALIAS"
},
"name": "ALIAS"
},
"expectedNode": "Identifier"
}
}
],
"source": null,
"declaration": null
}
],
"directives": []
}
}

View File

@ -0,0 +1 @@
export { %%NAME%% as %%ALIAS%% };

View File

@ -0,0 +1,135 @@
{
"type": "File",
"start": 0,
"end": 33,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 33
}
},
"program": {
"type": "Program",
"start": 0,
"end": 33,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 33
}
},
"sourceType": "module",
"interpreter": null,
"body": [
{
"type": "ExportNamedDeclaration",
"start": 0,
"end": 33,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 33
}
},
"specifiers": [
{
"type": "ExportSpecifier",
"start": 9,
"end": 30,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 30
}
},
"local": {
"type": "Placeholder",
"start": 9,
"end": 17,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 17
}
},
"name": {
"type": "Identifier",
"start": 11,
"end": 15,
"loc": {
"start": {
"line": 1,
"column": 11
},
"end": {
"line": 1,
"column": 15
},
"identifierName": "NAME"
},
"name": "NAME"
},
"expectedNode": "Identifier"
},
"exported": {
"type": "Placeholder",
"start": 21,
"end": 30,
"loc": {
"start": {
"line": 1,
"column": 21
},
"end": {
"line": 1,
"column": 30
}
},
"name": {
"type": "Identifier",
"start": 23,
"end": 28,
"loc": {
"start": {
"line": 1,
"column": 23
},
"end": {
"line": 1,
"column": 28
},
"identifierName": "ALIAS"
},
"name": "ALIAS"
},
"expectedNode": "Identifier"
}
}
],
"source": null,
"declaration": null
}
],
"directives": []
}
}

View File

@ -0,0 +1 @@
export { %%NAME%% as alias };

View File

@ -0,0 +1,119 @@
{
"type": "File",
"start": 0,
"end": 29,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 29
}
},
"program": {
"type": "Program",
"start": 0,
"end": 29,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 29
}
},
"sourceType": "module",
"interpreter": null,
"body": [
{
"type": "ExportNamedDeclaration",
"start": 0,
"end": 29,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 29
}
},
"specifiers": [
{
"type": "ExportSpecifier",
"start": 9,
"end": 26,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 26
}
},
"local": {
"type": "Placeholder",
"start": 9,
"end": 17,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 17
}
},
"name": {
"type": "Identifier",
"start": 11,
"end": 15,
"loc": {
"start": {
"line": 1,
"column": 11
},
"end": {
"line": 1,
"column": 15
},
"identifierName": "NAME"
},
"name": "NAME"
},
"expectedNode": "Identifier"
},
"exported": {
"type": "Identifier",
"start": 21,
"end": 26,
"loc": {
"start": {
"line": 1,
"column": 21
},
"end": {
"line": 1,
"column": 26
},
"identifierName": "alias"
},
"name": "alias"
}
}
],
"source": null,
"declaration": null
}
],
"directives": []
}
}

View File

@ -0,0 +1 @@
export { name } from %%FILE%%;

View File

@ -0,0 +1,135 @@
{
"type": "File",
"start": 0,
"end": 30,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 30
}
},
"program": {
"type": "Program",
"start": 0,
"end": 30,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 30
}
},
"sourceType": "module",
"interpreter": null,
"body": [
{
"type": "ExportNamedDeclaration",
"start": 0,
"end": 30,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 30
}
},
"specifiers": [
{
"type": "ExportSpecifier",
"start": 9,
"end": 13,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 13
}
},
"local": {
"type": "Identifier",
"start": 9,
"end": 13,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 13
},
"identifierName": "name"
},
"name": "name"
},
"exported": {
"type": "Identifier",
"start": 9,
"end": 13,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 13
},
"identifierName": "name"
},
"name": "name"
}
}
],
"source": {
"type": "Placeholder",
"start": 21,
"end": 29,
"loc": {
"start": {
"line": 1,
"column": 21
},
"end": {
"line": 1,
"column": 29
}
},
"name": {
"type": "Identifier",
"start": 23,
"end": 27,
"loc": {
"start": {
"line": 1,
"column": 23
},
"end": {
"line": 1,
"column": 27
},
"identifierName": "FILE"
},
"name": "FILE"
},
"expectedNode": "StringLiteral"
},
"declaration": null
}
],
"directives": []
}
}

View File

@ -0,0 +1 @@
export { %%NAME%% } from %%FILE%%;

View File

@ -0,0 +1,167 @@
{
"type": "File",
"start": 0,
"end": 34,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 34
}
},
"program": {
"type": "Program",
"start": 0,
"end": 34,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 34
}
},
"sourceType": "module",
"interpreter": null,
"body": [
{
"type": "ExportNamedDeclaration",
"start": 0,
"end": 34,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 34
}
},
"specifiers": [
{
"type": "ExportSpecifier",
"start": 9,
"end": 17,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 17
}
},
"local": {
"type": "Placeholder",
"start": 9,
"end": 17,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 17
}
},
"name": {
"type": "Identifier",
"start": 11,
"end": 15,
"loc": {
"start": {
"line": 1,
"column": 11
},
"end": {
"line": 1,
"column": 15
},
"identifierName": "NAME"
},
"name": "NAME"
},
"expectedNode": "Identifier"
},
"exported": {
"type": "Placeholder",
"start": 9,
"end": 17,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 17
}
},
"name": {
"type": "Identifier",
"start": 11,
"end": 15,
"loc": {
"start": {
"line": 1,
"column": 11
},
"end": {
"line": 1,
"column": 15
},
"identifierName": "NAME"
},
"name": "NAME"
},
"expectedNode": "Identifier"
}
}
],
"source": {
"type": "Placeholder",
"start": 25,
"end": 33,
"loc": {
"start": {
"line": 1,
"column": 25
},
"end": {
"line": 1,
"column": 33
}
},
"name": {
"type": "Identifier",
"start": 27,
"end": 31,
"loc": {
"start": {
"line": 1,
"column": 27
},
"end": {
"line": 1,
"column": 31
},
"identifierName": "FILE"
},
"name": "FILE"
},
"expectedNode": "StringLiteral"
},
"declaration": null
}
],
"directives": []
}
}

View File

@ -0,0 +1 @@
export { name as %%ALIAS%% } from "file";

View File

@ -0,0 +1,138 @@
{
"type": "File",
"start": 0,
"end": 41,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 41
}
},
"program": {
"type": "Program",
"start": 0,
"end": 41,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 41
}
},
"sourceType": "module",
"interpreter": null,
"body": [
{
"type": "ExportNamedDeclaration",
"start": 0,
"end": 41,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 41
}
},
"specifiers": [
{
"type": "ExportSpecifier",
"start": 9,
"end": 26,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 26
}
},
"local": {
"type": "Identifier",
"start": 9,
"end": 13,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 13
},
"identifierName": "name"
},
"name": "name"
},
"exported": {
"type": "Placeholder",
"start": 17,
"end": 26,
"loc": {
"start": {
"line": 1,
"column": 17
},
"end": {
"line": 1,
"column": 26
}
},
"name": {
"type": "Identifier",
"start": 19,
"end": 24,
"loc": {
"start": {
"line": 1,
"column": 19
},
"end": {
"line": 1,
"column": 24
},
"identifierName": "ALIAS"
},
"name": "ALIAS"
},
"expectedNode": "Identifier"
}
}
],
"source": {
"type": "StringLiteral",
"start": 34,
"end": 40,
"loc": {
"start": {
"line": 1,
"column": 34
},
"end": {
"line": 1,
"column": 40
}
},
"extra": {
"rawValue": "file",
"raw": "\"file\""
},
"value": "file"
},
"declaration": null
}
],
"directives": []
}
}

View File

@ -0,0 +1 @@
export { %%NAME%% as %%ALIAS%% } from "file";

View File

@ -0,0 +1,154 @@
{
"type": "File",
"start": 0,
"end": 45,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 45
}
},
"program": {
"type": "Program",
"start": 0,
"end": 45,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 45
}
},
"sourceType": "module",
"interpreter": null,
"body": [
{
"type": "ExportNamedDeclaration",
"start": 0,
"end": 45,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 45
}
},
"specifiers": [
{
"type": "ExportSpecifier",
"start": 9,
"end": 30,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 30
}
},
"local": {
"type": "Placeholder",
"start": 9,
"end": 17,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 17
}
},
"name": {
"type": "Identifier",
"start": 11,
"end": 15,
"loc": {
"start": {
"line": 1,
"column": 11
},
"end": {
"line": 1,
"column": 15
},
"identifierName": "NAME"
},
"name": "NAME"
},
"expectedNode": "Identifier"
},
"exported": {
"type": "Placeholder",
"start": 21,
"end": 30,
"loc": {
"start": {
"line": 1,
"column": 21
},
"end": {
"line": 1,
"column": 30
}
},
"name": {
"type": "Identifier",
"start": 23,
"end": 28,
"loc": {
"start": {
"line": 1,
"column": 23
},
"end": {
"line": 1,
"column": 28
},
"identifierName": "ALIAS"
},
"name": "ALIAS"
},
"expectedNode": "Identifier"
}
}
],
"source": {
"type": "StringLiteral",
"start": 38,
"end": 44,
"loc": {
"start": {
"line": 1,
"column": 38
},
"end": {
"line": 1,
"column": 44
}
},
"extra": {
"rawValue": "file",
"raw": "\"file\""
},
"value": "file"
},
"declaration": null
}
],
"directives": []
}
}

View File

@ -0,0 +1 @@
export { %%NAME%% as alias } from "file";

View File

@ -0,0 +1,138 @@
{
"type": "File",
"start": 0,
"end": 41,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 41
}
},
"program": {
"type": "Program",
"start": 0,
"end": 41,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 41
}
},
"sourceType": "module",
"interpreter": null,
"body": [
{
"type": "ExportNamedDeclaration",
"start": 0,
"end": 41,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 41
}
},
"specifiers": [
{
"type": "ExportSpecifier",
"start": 9,
"end": 26,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 26
}
},
"local": {
"type": "Placeholder",
"start": 9,
"end": 17,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 17
}
},
"name": {
"type": "Identifier",
"start": 11,
"end": 15,
"loc": {
"start": {
"line": 1,
"column": 11
},
"end": {
"line": 1,
"column": 15
},
"identifierName": "NAME"
},
"name": "NAME"
},
"expectedNode": "Identifier"
},
"exported": {
"type": "Identifier",
"start": 21,
"end": 26,
"loc": {
"start": {
"line": 1,
"column": 21
},
"end": {
"line": 1,
"column": 26
},
"identifierName": "alias"
},
"name": "alias"
}
}
],
"source": {
"type": "StringLiteral",
"start": 34,
"end": 40,
"loc": {
"start": {
"line": 1,
"column": 34
},
"end": {
"line": 1,
"column": 40
}
},
"extra": {
"rawValue": "file",
"raw": "\"file\""
},
"value": "file"
},
"declaration": null
}
],
"directives": []
}
}

View File

@ -0,0 +1 @@
export { %%NAME%% } from "file";

View File

@ -0,0 +1,154 @@
{
"type": "File",
"start": 0,
"end": 32,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 32
}
},
"program": {
"type": "Program",
"start": 0,
"end": 32,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 32
}
},
"sourceType": "module",
"interpreter": null,
"body": [
{
"type": "ExportNamedDeclaration",
"start": 0,
"end": 32,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 32
}
},
"specifiers": [
{
"type": "ExportSpecifier",
"start": 9,
"end": 17,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 17
}
},
"local": {
"type": "Placeholder",
"start": 9,
"end": 17,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 17
}
},
"name": {
"type": "Identifier",
"start": 11,
"end": 15,
"loc": {
"start": {
"line": 1,
"column": 11
},
"end": {
"line": 1,
"column": 15
},
"identifierName": "NAME"
},
"name": "NAME"
},
"expectedNode": "Identifier"
},
"exported": {
"type": "Placeholder",
"start": 9,
"end": 17,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 17
}
},
"name": {
"type": "Identifier",
"start": 11,
"end": 15,
"loc": {
"start": {
"line": 1,
"column": 11
},
"end": {
"line": 1,
"column": 15
},
"identifierName": "NAME"
},
"name": "NAME"
},
"expectedNode": "Identifier"
}
}
],
"source": {
"type": "StringLiteral",
"start": 25,
"end": 31,
"loc": {
"start": {
"line": 1,
"column": 25
},
"end": {
"line": 1,
"column": 31
}
},
"extra": {
"rawValue": "file",
"raw": "\"file\""
},
"value": "file"
},
"declaration": null
}
],
"directives": []
}
}

View File

@ -0,0 +1 @@
export { %%NAME%% };

View File

@ -0,0 +1,135 @@
{
"type": "File",
"start": 0,
"end": 20,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 20
}
},
"program": {
"type": "Program",
"start": 0,
"end": 20,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 20
}
},
"sourceType": "module",
"interpreter": null,
"body": [
{
"type": "ExportNamedDeclaration",
"start": 0,
"end": 20,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 20
}
},
"specifiers": [
{
"type": "ExportSpecifier",
"start": 9,
"end": 17,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 17
}
},
"local": {
"type": "Placeholder",
"start": 9,
"end": 17,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 17
}
},
"name": {
"type": "Identifier",
"start": 11,
"end": 15,
"loc": {
"start": {
"line": 1,
"column": 11
},
"end": {
"line": 1,
"column": 15
},
"identifierName": "NAME"
},
"name": "NAME"
},
"expectedNode": "Identifier"
},
"exported": {
"type": "Placeholder",
"start": 9,
"end": 17,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 17
}
},
"name": {
"type": "Identifier",
"start": 11,
"end": 15,
"loc": {
"start": {
"line": 1,
"column": 11
},
"end": {
"line": 1,
"column": 15
},
"identifierName": "NAME"
},
"name": "NAME"
},
"expectedNode": "Identifier"
}
}
],
"source": null,
"declaration": null
}
],
"directives": []
}
}

View File

@ -0,0 +1,4 @@
{
"plugins": ["placeholders", "exportDefaultFrom", "exportNamespaceFrom"],
"sourceType": "module"
}

View File

@ -0,0 +1 @@
export * as %%STAR%% from "file";

View File

@ -0,0 +1,7 @@
{
"plugins": [
"placeholders"
],
"sourceType": "module",
"throws": "This experimental syntax requires enabling the parser plugin: 'exportNamespaceFrom' (1:9)"
}

View File

@ -0,0 +1 @@
export * as %%STAR%% from %%FILE%%;

View File

@ -0,0 +1,7 @@
{
"plugins": [
"placeholders"
],
"sourceType": "module",
"throws": "This experimental syntax requires enabling the parser plugin: 'exportNamespaceFrom' (1:9)"
}

View File

@ -0,0 +1 @@
export * from %%FILE%%;

View File

@ -0,0 +1,83 @@
{
"type": "File",
"start": 0,
"end": 23,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 23
}
},
"program": {
"type": "Program",
"start": 0,
"end": 23,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 23
}
},
"sourceType": "module",
"interpreter": null,
"body": [
{
"type": "ExportAllDeclaration",
"start": 0,
"end": 23,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 23
}
},
"source": {
"type": "Placeholder",
"start": 14,
"end": 22,
"loc": {
"start": {
"line": 1,
"column": 14
},
"end": {
"line": 1,
"column": 22
}
},
"name": {
"type": "Identifier",
"start": 16,
"end": 20,
"loc": {
"start": {
"line": 1,
"column": 16
},
"end": {
"line": 1,
"column": 20
},
"identifierName": "FILE"
},
"name": "FILE"
},
"expectedNode": "StringLiteral"
}
}
],
"directives": []
}
}

View File

@ -0,0 +1 @@
%%FOO%% + %%BAR%%(%%BAZ%%);

View File

@ -0,0 +1,182 @@
{
"type": "File",
"start": 0,
"end": 27,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 27
}
},
"program": {
"type": "Program",
"start": 0,
"end": 27,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 27
}
},
"sourceType": "script",
"interpreter": null,
"body": [
{
"type": "ExpressionStatement",
"start": 0,
"end": 27,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 27
}
},
"expression": {
"type": "BinaryExpression",
"start": 0,
"end": 26,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 26
}
},
"left": {
"type": "Placeholder",
"start": 0,
"end": 7,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 7
}
},
"name": {
"type": "Identifier",
"start": 2,
"end": 5,
"loc": {
"start": {
"line": 1,
"column": 2
},
"end": {
"line": 1,
"column": 5
},
"identifierName": "FOO"
},
"name": "FOO"
},
"expectedNode": "Expression"
},
"operator": "+",
"right": {
"type": "CallExpression",
"start": 10,
"end": 26,
"loc": {
"start": {
"line": 1,
"column": 10
},
"end": {
"line": 1,
"column": 26
}
},
"callee": {
"type": "Placeholder",
"start": 10,
"end": 17,
"loc": {
"start": {
"line": 1,
"column": 10
},
"end": {
"line": 1,
"column": 17
}
},
"name": {
"type": "Identifier",
"start": 12,
"end": 15,
"loc": {
"start": {
"line": 1,
"column": 12
},
"end": {
"line": 1,
"column": 15
},
"identifierName": "BAR"
},
"name": "BAR"
},
"expectedNode": "Expression"
},
"arguments": [
{
"type": "Placeholder",
"start": 18,
"end": 25,
"loc": {
"start": {
"line": 1,
"column": 18
},
"end": {
"line": 1,
"column": 25
}
},
"name": {
"type": "Identifier",
"start": 20,
"end": 23,
"loc": {
"start": {
"line": 1,
"column": 20
},
"end": {
"line": 1,
"column": 23
},
"identifierName": "BAZ"
},
"name": "BAZ"
},
"expectedNode": "Expression"
}
]
}
}
}
],
"directives": []
}
}

View File

@ -0,0 +1,3 @@
{
"plugins": ["placeholders"]
}

View File

@ -0,0 +1 @@
function f() %%BODY%%

View File

@ -0,0 +1,103 @@
{
"type": "File",
"start": 0,
"end": 21,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 21
}
},
"program": {
"type": "Program",
"start": 0,
"end": 21,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 21
}
},
"sourceType": "script",
"interpreter": null,
"body": [
{
"type": "FunctionDeclaration",
"start": 0,
"end": 21,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 21
}
},
"id": {
"type": "Identifier",
"start": 9,
"end": 10,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 10
},
"identifierName": "f"
},
"name": "f"
},
"generator": false,
"async": false,
"params": [],
"body": {
"type": "Placeholder",
"start": 13,
"end": 21,
"loc": {
"start": {
"line": 1,
"column": 13
},
"end": {
"line": 1,
"column": 21
}
},
"name": {
"type": "Identifier",
"start": 15,
"end": 19,
"loc": {
"start": {
"line": 1,
"column": 15
},
"end": {
"line": 1,
"column": 19
},
"identifierName": "BODY"
},
"name": "BODY"
},
"expectedNode": "BlockStatement"
}
}
],
"directives": []
}
}

View File

@ -0,0 +1 @@
function %%ID%%(%%PARAM%%, %%PARAM%%) %%BODY%%

View File

@ -0,0 +1,186 @@
{
"type": "File",
"start": 0,
"end": 46,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 46
}
},
"program": {
"type": "Program",
"start": 0,
"end": 46,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 46
}
},
"sourceType": "script",
"interpreter": null,
"body": [
{
"type": "FunctionDeclaration",
"start": 0,
"end": 46,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 46
}
},
"id": {
"type": "Placeholder",
"start": 9,
"end": 15,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 15
}
},
"name": {
"type": "Identifier",
"start": 11,
"end": 13,
"loc": {
"start": {
"line": 1,
"column": 11
},
"end": {
"line": 1,
"column": 13
},
"identifierName": "ID"
},
"name": "ID"
},
"expectedNode": "Identifier"
},
"generator": false,
"async": false,
"params": [
{
"type": "Placeholder",
"start": 16,
"end": 25,
"loc": {
"start": {
"line": 1,
"column": 16
},
"end": {
"line": 1,
"column": 25
}
},
"name": {
"type": "Identifier",
"start": 18,
"end": 23,
"loc": {
"start": {
"line": 1,
"column": 18
},
"end": {
"line": 1,
"column": 23
},
"identifierName": "PARAM"
},
"name": "PARAM"
},
"expectedNode": "Pattern"
},
{
"type": "Placeholder",
"start": 27,
"end": 36,
"loc": {
"start": {
"line": 1,
"column": 27
},
"end": {
"line": 1,
"column": 36
}
},
"name": {
"type": "Identifier",
"start": 29,
"end": 34,
"loc": {
"start": {
"line": 1,
"column": 29
},
"end": {
"line": 1,
"column": 34
},
"identifierName": "PARAM"
},
"name": "PARAM"
},
"expectedNode": "Pattern"
}
],
"body": {
"type": "Placeholder",
"start": 38,
"end": 46,
"loc": {
"start": {
"line": 1,
"column": 38
},
"end": {
"line": 1,
"column": 46
}
},
"name": {
"type": "Identifier",
"start": 40,
"end": 44,
"loc": {
"start": {
"line": 1,
"column": 40
},
"end": {
"line": 1,
"column": 44
},
"identifierName": "BODY"
},
"name": "BODY"
},
"expectedNode": "BlockStatement"
}
}
],
"directives": []
}
}

View File

@ -0,0 +1 @@
function %%ID%%() {}

View File

@ -0,0 +1,103 @@
{
"type": "File",
"start": 0,
"end": 20,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 20
}
},
"program": {
"type": "Program",
"start": 0,
"end": 20,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 20
}
},
"sourceType": "script",
"interpreter": null,
"body": [
{
"type": "FunctionDeclaration",
"start": 0,
"end": 20,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 20
}
},
"id": {
"type": "Placeholder",
"start": 9,
"end": 15,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 15
}
},
"name": {
"type": "Identifier",
"start": 11,
"end": 13,
"loc": {
"start": {
"line": 1,
"column": 11
},
"end": {
"line": 1,
"column": 13
},
"identifierName": "ID"
},
"name": "ID"
},
"expectedNode": "Identifier"
},
"generator": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 18,
"end": 20,
"loc": {
"start": {
"line": 1,
"column": 18
},
"end": {
"line": 1,
"column": 20
}
},
"body": [],
"directives": []
}
}
],
"directives": []
}
}

View File

@ -0,0 +1 @@
void function %%ID%%() {};

View File

@ -0,0 +1,135 @@
{
"type": "File",
"start": 0,
"end": 26,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 26
}
},
"program": {
"type": "Program",
"start": 0,
"end": 26,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 26
}
},
"sourceType": "script",
"interpreter": null,
"body": [
{
"type": "ExpressionStatement",
"start": 0,
"end": 26,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 26
}
},
"expression": {
"type": "UnaryExpression",
"start": 0,
"end": 25,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 25
}
},
"operator": "void",
"prefix": true,
"argument": {
"type": "FunctionExpression",
"start": 5,
"end": 25,
"loc": {
"start": {
"line": 1,
"column": 5
},
"end": {
"line": 1,
"column": 25
}
},
"id": {
"type": "Placeholder",
"start": 14,
"end": 20,
"loc": {
"start": {
"line": 1,
"column": 14
},
"end": {
"line": 1,
"column": 20
}
},
"name": {
"type": "Identifier",
"start": 16,
"end": 18,
"loc": {
"start": {
"line": 1,
"column": 16
},
"end": {
"line": 1,
"column": 18
},
"identifierName": "ID"
},
"name": "ID"
},
"expectedNode": "Identifier"
},
"generator": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 23,
"end": 25,
"loc": {
"start": {
"line": 1,
"column": 23
},
"end": {
"line": 1,
"column": 25
}
},
"body": [],
"directives": []
}
}
}
}
],
"directives": []
}
}

View File

@ -0,0 +1 @@
function f(%%PARAM%%) {}

View File

@ -0,0 +1,121 @@
{
"type": "File",
"start": 0,
"end": 24,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 24
}
},
"program": {
"type": "Program",
"start": 0,
"end": 24,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 24
}
},
"sourceType": "script",
"interpreter": null,
"body": [
{
"type": "FunctionDeclaration",
"start": 0,
"end": 24,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 24
}
},
"id": {
"type": "Identifier",
"start": 9,
"end": 10,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 10
},
"identifierName": "f"
},
"name": "f"
},
"generator": false,
"async": false,
"params": [
{
"type": "Placeholder",
"start": 11,
"end": 20,
"loc": {
"start": {
"line": 1,
"column": 11
},
"end": {
"line": 1,
"column": 20
}
},
"name": {
"type": "Identifier",
"start": 13,
"end": 18,
"loc": {
"start": {
"line": 1,
"column": 13
},
"end": {
"line": 1,
"column": 18
},
"identifierName": "PARAM"
},
"name": "PARAM"
},
"expectedNode": "Pattern"
}
],
"body": {
"type": "BlockStatement",
"start": 22,
"end": 24,
"loc": {
"start": {
"line": 1,
"column": 22
},
"end": {
"line": 1,
"column": 24
}
},
"body": [],
"directives": []
}
}
],
"directives": []
}
}

View File

@ -0,0 +1 @@
import %%DEFAULT%% from %%FILE%%;

View File

@ -0,0 +1,133 @@
{
"type": "File",
"start": 0,
"end": 33,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 33
}
},
"program": {
"type": "Program",
"start": 0,
"end": 33,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 33
}
},
"sourceType": "module",
"interpreter": null,
"body": [
{
"type": "ImportDeclaration",
"start": 0,
"end": 33,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 33
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 7,
"end": 18,
"loc": {
"start": {
"line": 1,
"column": 7
},
"end": {
"line": 1,
"column": 18
}
},
"local": {
"type": "Placeholder",
"start": 7,
"end": 18,
"loc": {
"start": {
"line": 1,
"column": 7
},
"end": {
"line": 1,
"column": 18
}
},
"name": {
"type": "Identifier",
"start": 9,
"end": 16,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 16
},
"identifierName": "DEFAULT"
},
"name": "DEFAULT"
},
"expectedNode": "Identifier"
}
}
],
"source": {
"type": "Placeholder",
"start": 24,
"end": 32,
"loc": {
"start": {
"line": 1,
"column": 24
},
"end": {
"line": 1,
"column": 32
}
},
"name": {
"type": "Identifier",
"start": 26,
"end": 30,
"loc": {
"start": {
"line": 1,
"column": 26
},
"end": {
"line": 1,
"column": 30
},
"identifierName": "FILE"
},
"name": "FILE"
},
"expectedNode": "StringLiteral"
}
}
],
"directives": []
}
}

View File

@ -0,0 +1 @@
import %%DEFAULT%%, { named } from "file";

View File

@ -0,0 +1,169 @@
{
"type": "File",
"start": 0,
"end": 42,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 42
}
},
"program": {
"type": "Program",
"start": 0,
"end": 42,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 42
}
},
"sourceType": "module",
"interpreter": null,
"body": [
{
"type": "ImportDeclaration",
"start": 0,
"end": 42,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 42
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 7,
"end": 18,
"loc": {
"start": {
"line": 1,
"column": 7
},
"end": {
"line": 1,
"column": 18
}
},
"local": {
"type": "Placeholder",
"start": 7,
"end": 18,
"loc": {
"start": {
"line": 1,
"column": 7
},
"end": {
"line": 1,
"column": 18
}
},
"name": {
"type": "Identifier",
"start": 9,
"end": 16,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 16
},
"identifierName": "DEFAULT"
},
"name": "DEFAULT"
},
"expectedNode": "Identifier"
}
},
{
"type": "ImportSpecifier",
"start": 22,
"end": 27,
"loc": {
"start": {
"line": 1,
"column": 22
},
"end": {
"line": 1,
"column": 27
}
},
"imported": {
"type": "Identifier",
"start": 22,
"end": 27,
"loc": {
"start": {
"line": 1,
"column": 22
},
"end": {
"line": 1,
"column": 27
},
"identifierName": "named"
},
"name": "named"
},
"local": {
"type": "Identifier",
"start": 22,
"end": 27,
"loc": {
"start": {
"line": 1,
"column": 22
},
"end": {
"line": 1,
"column": 27
},
"identifierName": "named"
},
"name": "named"
}
}
],
"source": {
"type": "StringLiteral",
"start": 35,
"end": 41,
"loc": {
"start": {
"line": 1,
"column": 35
},
"end": {
"line": 1,
"column": 41
}
},
"extra": {
"rawValue": "file",
"raw": "\"file\""
},
"value": "file"
}
}
],
"directives": []
}
}

View File

@ -0,0 +1 @@
import %%DEFAULT%%, { %%NAMED%% } from "file";

View File

@ -0,0 +1,201 @@
{
"type": "File",
"start": 0,
"end": 46,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 46
}
},
"program": {
"type": "Program",
"start": 0,
"end": 46,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 46
}
},
"sourceType": "module",
"interpreter": null,
"body": [
{
"type": "ImportDeclaration",
"start": 0,
"end": 46,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 46
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 7,
"end": 18,
"loc": {
"start": {
"line": 1,
"column": 7
},
"end": {
"line": 1,
"column": 18
}
},
"local": {
"type": "Placeholder",
"start": 7,
"end": 18,
"loc": {
"start": {
"line": 1,
"column": 7
},
"end": {
"line": 1,
"column": 18
}
},
"name": {
"type": "Identifier",
"start": 9,
"end": 16,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 16
},
"identifierName": "DEFAULT"
},
"name": "DEFAULT"
},
"expectedNode": "Identifier"
}
},
{
"type": "ImportSpecifier",
"start": 22,
"end": 31,
"loc": {
"start": {
"line": 1,
"column": 22
},
"end": {
"line": 1,
"column": 31
}
},
"imported": {
"type": "Placeholder",
"start": 22,
"end": 31,
"loc": {
"start": {
"line": 1,
"column": 22
},
"end": {
"line": 1,
"column": 31
}
},
"name": {
"type": "Identifier",
"start": 24,
"end": 29,
"loc": {
"start": {
"line": 1,
"column": 24
},
"end": {
"line": 1,
"column": 29
},
"identifierName": "NAMED"
},
"name": "NAMED"
},
"expectedNode": "Identifier"
},
"local": {
"type": "Placeholder",
"start": 22,
"end": 31,
"loc": {
"start": {
"line": 1,
"column": 22
},
"end": {
"line": 1,
"column": 31
}
},
"name": {
"type": "Identifier",
"start": 24,
"end": 29,
"loc": {
"start": {
"line": 1,
"column": 24
},
"end": {
"line": 1,
"column": 29
},
"identifierName": "NAMED"
},
"name": "NAMED"
},
"expectedNode": "Identifier"
}
}
],
"source": {
"type": "StringLiteral",
"start": 39,
"end": 45,
"loc": {
"start": {
"line": 1,
"column": 39
},
"end": {
"line": 1,
"column": 45
}
},
"extra": {
"rawValue": "file",
"raw": "\"file\""
},
"value": "file"
}
}
],
"directives": []
}
}

View File

@ -0,0 +1 @@
import _default, { %%NAMED%% } from "file";

View File

@ -0,0 +1,185 @@
{
"type": "File",
"start": 0,
"end": 43,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 43
}
},
"program": {
"type": "Program",
"start": 0,
"end": 43,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 43
}
},
"sourceType": "module",
"interpreter": null,
"body": [
{
"type": "ImportDeclaration",
"start": 0,
"end": 43,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 43
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 7,
"end": 15,
"loc": {
"start": {
"line": 1,
"column": 7
},
"end": {
"line": 1,
"column": 15
}
},
"local": {
"type": "Identifier",
"start": 7,
"end": 15,
"loc": {
"start": {
"line": 1,
"column": 7
},
"end": {
"line": 1,
"column": 15
},
"identifierName": "_default"
},
"name": "_default"
}
},
{
"type": "ImportSpecifier",
"start": 19,
"end": 28,
"loc": {
"start": {
"line": 1,
"column": 19
},
"end": {
"line": 1,
"column": 28
}
},
"imported": {
"type": "Placeholder",
"start": 19,
"end": 28,
"loc": {
"start": {
"line": 1,
"column": 19
},
"end": {
"line": 1,
"column": 28
}
},
"name": {
"type": "Identifier",
"start": 21,
"end": 26,
"loc": {
"start": {
"line": 1,
"column": 21
},
"end": {
"line": 1,
"column": 26
},
"identifierName": "NAMED"
},
"name": "NAMED"
},
"expectedNode": "Identifier"
},
"local": {
"type": "Placeholder",
"start": 19,
"end": 28,
"loc": {
"start": {
"line": 1,
"column": 19
},
"end": {
"line": 1,
"column": 28
}
},
"name": {
"type": "Identifier",
"start": 21,
"end": 26,
"loc": {
"start": {
"line": 1,
"column": 21
},
"end": {
"line": 1,
"column": 26
},
"identifierName": "NAMED"
},
"name": "NAMED"
},
"expectedNode": "Identifier"
}
}
],
"source": {
"type": "StringLiteral",
"start": 36,
"end": 42,
"loc": {
"start": {
"line": 1,
"column": 36
},
"end": {
"line": 1,
"column": 42
}
},
"extra": {
"rawValue": "file",
"raw": "\"file\""
},
"value": "file"
}
}
],
"directives": []
}
}

View File

@ -0,0 +1 @@
import _default, * as %%STAR%% from "file";

Some files were not shown because too many files have changed in this diff Show More