Ensure that Program nodes have a sourceType.
This commit is contained in:
parent
b83fa26937
commit
fec79e358c
@ -104,7 +104,7 @@ function buildRuntimeRewritePlugin(relativePath, helperName) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function buildHelper(helperName, modules, useBuiltIns) {
|
function buildHelper(helperName, modules, useBuiltIns) {
|
||||||
const tree = t.program(helpers.get(helperName).nodes);
|
const tree = t.program(helpers.get(helperName).nodes, [], "module");
|
||||||
|
|
||||||
const transformOpts = makeTransformOpts(modules, useBuiltIns);
|
const transformOpts = makeTransformOpts(modules, useBuiltIns);
|
||||||
|
|
||||||
|
|||||||
@ -513,13 +513,14 @@ defineType("NewExpression", { inherits: "CallExpression" });
|
|||||||
|
|
||||||
defineType("Program", {
|
defineType("Program", {
|
||||||
visitor: ["directives", "body"],
|
visitor: ["directives", "body"],
|
||||||
builder: ["body", "directives"],
|
builder: ["body", "directives", "sourceType"],
|
||||||
fields: {
|
fields: {
|
||||||
sourceFile: {
|
sourceFile: {
|
||||||
validate: assertValueType("string"),
|
validate: assertValueType("string"),
|
||||||
},
|
},
|
||||||
sourceType: {
|
sourceType: {
|
||||||
validate: assertOneOf("script", "module"),
|
validate: assertOneOf("script", "module"),
|
||||||
|
default: "script",
|
||||||
},
|
},
|
||||||
directives: {
|
directives: {
|
||||||
validate: chain(
|
validate: chain(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user