Skip to content

Commit 7be80ce

Browse files
hronrodeamme
authored andcommitted
use import syntax to import Inferno namespace
1 parent 4e49544 commit 7be80ce

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+50
-52
lines changed

src/updateSourceFile.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,15 @@ export default (sourceFile: ts.SourceFile, context) => {
3030
}
3131

3232
statements.unshift(
33-
ts.createVariableStatement(undefined, [
34-
ts.createVariableDeclaration(
35-
"Inferno",
33+
ts.createImportDeclaration(
34+
undefined,
35+
undefined,
36+
ts.createImportClause(
3637
undefined,
37-
ts.createCall(
38-
ts.createIdentifier("require"),
39-
[],
40-
[ts.createLiteral("inferno")]
41-
)
42-
)
43-
])
38+
ts.createNamespaceImport(ts.createIdentifier("Inferno"))
39+
),
40+
ts.createLiteral("inferno")
41+
)
4442
);
4543

4644
return ts.updateSourceFileNode(sourceFile, statements);

tests/references/Component1.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
var Inferno = require("inferno");
1+
import * as Inferno from "inferno";
22
var createComponentVNode = Inferno.createComponentVNode;
33
createComponentVNode(2, Com, { "children": a });

tests/references/Component2.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var Inferno = require("inferno");
1+
import * as Inferno from "inferno";
22
var createComponentVNode = Inferno.createComponentVNode;
33
createComponentVNode(2, Com, { "children": [a,
44
b,

tests/references/Component3.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var Inferno = require("inferno");
1+
import * as Inferno from "inferno";
22
var createTextVNode = Inferno.createTextVNode;
33
var createComponentVNode = Inferno.createComponentVNode;
44
var createVNode = Inferno.createVNode;

tests/references/Component4.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
var Inferno = require("inferno");
1+
import * as Inferno from "inferno";
22
var createComponentVNode = Inferno.createComponentVNode;
33
createComponentVNode(2, Context.Provider);

tests/references/advancedExpression.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var Inferno = require("inferno");
1+
import * as Inferno from "inferno";
22
var createComponentVNode = Inferno.createComponentVNode;
33
var createVNode = Inferno.createVNode;
44
function MyComponent(props) {

tests/references/advancedWithImports.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ var __extends = (this && this.__extends) || (function () {
1414
if (v !== undefined) module.exports = v;
1515
}
1616
else if (typeof define === "function" && define.amd) {
17-
define(["require", "exports", "inferno", "inferno-component", "./components/Incrementer"], factory);
17+
define(["require", "exports", "inferno", "inferno", "inferno-component", "./components/Incrementer"], factory);
1818
}
1919
})(function (require, exports) {
2020
"use strict";
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var Inferno = require("inferno");
1+
import * as Inferno from "inferno";
22
var createTextVNode = Inferno.createTextVNode;
33
var createVNode = Inferno.createVNode;
44
createVNode(1, "div", null, createTextVNode("test"), 2);
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
var Inferno = require("inferno");
1+
import * as Inferno from "inferno";
22
var createVNode = Inferno.createVNode;
33
createVNode(1, "foo");
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
var Inferno = require("inferno");
1+
import * as Inferno from "inferno";
22
var createComponentVNode = Inferno.createComponentVNode;
33
createComponentVNode(2, Context.Provider, { "children": "test" });

0 commit comments

Comments
 (0)