Skip to content

Commit

Permalink
use import syntax to import Inferno namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
hronro authored and deamme committed Jul 27, 2018
1 parent 4e49544 commit 7be80ce
Show file tree
Hide file tree
Showing 43 changed files with 50 additions and 52 deletions.
18 changes: 8 additions & 10 deletions src/updateSourceFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,15 @@ export default (sourceFile: ts.SourceFile, context) => {
}

statements.unshift(
ts.createVariableStatement(undefined, [
ts.createVariableDeclaration(
"Inferno",
ts.createImportDeclaration(
undefined,
undefined,
ts.createImportClause(
undefined,
ts.createCall(
ts.createIdentifier("require"),
[],
[ts.createLiteral("inferno")]
)
)
])
ts.createNamespaceImport(ts.createIdentifier("Inferno"))
),
ts.createLiteral("inferno")
)
);

return ts.updateSourceFileNode(sourceFile, statements);
Expand Down
2 changes: 1 addition & 1 deletion tests/references/Component1.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
var Inferno = require("inferno");
import * as Inferno from "inferno";
var createComponentVNode = Inferno.createComponentVNode;
createComponentVNode(2, Com, { "children": a });
2 changes: 1 addition & 1 deletion tests/references/Component2.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var Inferno = require("inferno");
import * as Inferno from "inferno";
var createComponentVNode = Inferno.createComponentVNode;
createComponentVNode(2, Com, { "children": [a,
b,
Expand Down
2 changes: 1 addition & 1 deletion tests/references/Component3.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var Inferno = require("inferno");
import * as Inferno from "inferno";
var createTextVNode = Inferno.createTextVNode;
var createComponentVNode = Inferno.createComponentVNode;
var createVNode = Inferno.createVNode;
Expand Down
2 changes: 1 addition & 1 deletion tests/references/Component4.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
var Inferno = require("inferno");
import * as Inferno from "inferno";
var createComponentVNode = Inferno.createComponentVNode;
createComponentVNode(2, Context.Provider);
2 changes: 1 addition & 1 deletion tests/references/advancedExpression.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var Inferno = require("inferno");
import * as Inferno from "inferno";
var createComponentVNode = Inferno.createComponentVNode;
var createVNode = Inferno.createVNode;
function MyComponent(props) {
Expand Down
2 changes: 1 addition & 1 deletion tests/references/advancedWithImports.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ var __extends = (this && this.__extends) || (function () {
if (v !== undefined) module.exports = v;
}
else if (typeof define === "function" && define.amd) {
define(["require", "exports", "inferno", "inferno-component", "./components/Incrementer"], factory);
define(["require", "exports", "inferno", "inferno", "inferno-component", "./components/Incrementer"], factory);
}
})(function (require, exports) {
"use strict";
Expand Down
2 changes: 1 addition & 1 deletion tests/references/childrenProps1.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var Inferno = require("inferno");
import * as Inferno from "inferno";
var createTextVNode = Inferno.createTextVNode;
var createVNode = Inferno.createVNode;
createVNode(1, "div", null, createTextVNode("test"), 2);
2 changes: 1 addition & 1 deletion tests/references/childrenProps10.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
var Inferno = require("inferno");
import * as Inferno from "inferno";
var createVNode = Inferno.createVNode;
createVNode(1, "foo");
2 changes: 1 addition & 1 deletion tests/references/childrenProps11.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
var Inferno = require("inferno");
import * as Inferno from "inferno";
var createComponentVNode = Inferno.createComponentVNode;
createComponentVNode(2, Context.Provider, { "children": "test" });
2 changes: 1 addition & 1 deletion tests/references/childrenProps2.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var Inferno = require("inferno");
import * as Inferno from "inferno";
var createTextVNode = Inferno.createTextVNode;
var createVNode = Inferno.createVNode;
createVNode(1, "div", null, createTextVNode("ab"), 2);
2 changes: 1 addition & 1 deletion tests/references/childrenProps3.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var Inferno = require("inferno");
import * as Inferno from "inferno";
var createTextVNode = Inferno.createTextVNode;
var createVNode = Inferno.createVNode;
createVNode(1, "div", null, createTextVNode("ab"), 2);
2 changes: 1 addition & 1 deletion tests/references/childrenProps4.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
var Inferno = require("inferno");
import * as Inferno from "inferno";
var createComponentVNode = Inferno.createComponentVNode;
createComponentVNode(2, Com, { "children": "test" });
2 changes: 1 addition & 1 deletion tests/references/childrenProps5.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
var Inferno = require("inferno");
import * as Inferno from "inferno";
var createComponentVNode = Inferno.createComponentVNode;
createComponentVNode(2, Com, { "children": "ab" });
2 changes: 1 addition & 1 deletion tests/references/childrenProps6.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
var Inferno = require("inferno");
import * as Inferno from "inferno";
var createComponentVNode = Inferno.createComponentVNode;
createComponentVNode(2, Com, { "children": "ab" });
2 changes: 1 addition & 1 deletion tests/references/childrenProps7.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
var Inferno = require("inferno");
import * as Inferno from "inferno";
var createComponentVNode = Inferno.createComponentVNode;
createComponentVNode(2, Com);
2 changes: 1 addition & 1 deletion tests/references/childrenProps8.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var Inferno = require("inferno");
import * as Inferno from "inferno";
var createTextVNode = Inferno.createTextVNode;
var createComponentVNode = Inferno.createComponentVNode;
var createVNode = Inferno.createVNode;
Expand Down
2 changes: 1 addition & 1 deletion tests/references/childrenProps9.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var Inferno = require("inferno");
import * as Inferno from "inferno";
var createTextVNode = Inferno.createTextVNode;
var createVNode = Inferno.createVNode;
createVNode(1, "foo", null, createVNode(1, "span", null, createTextVNode("b"), 2), 2);
2 changes: 1 addition & 1 deletion tests/references/div.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
var Inferno = require("inferno");
import * as Inferno from "inferno";
var createVNode = Inferno.createVNode;
createVNode(1, "div");
2 changes: 1 addition & 1 deletion tests/references/divSelfClosed.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
var Inferno = require("inferno");
import * as Inferno from "inferno";
var createVNode = Inferno.createVNode;
createVNode(1, "div");
2 changes: 1 addition & 1 deletion tests/references/divWithAttributeReturningJSX.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
var Inferno = require("inferno");
import * as Inferno from "inferno";
var createVNode = Inferno.createVNode;
createVNode(1, "div", null, null, 1, { "foo": function () { return (createVNode(1, "div", null, null, 1, { "bar": true })); } });
2 changes: 1 addition & 1 deletion tests/references/divWithChild.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var Inferno = require("inferno");
import * as Inferno from "inferno";
var createTextVNode = Inferno.createTextVNode;
var createVNode = Inferno.createVNode;
createVNode(1, "div", null, createTextVNode("1"), 2);
2 changes: 1 addition & 1 deletion tests/references/divWithChildAndClassExpression.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var Inferno = require("inferno");
import * as Inferno from "inferno";
var createTextVNode = Inferno.createTextVNode;
var createVNode = Inferno.createVNode;
createVNode(1, "div", "first" + "second", createTextVNode("1"), 2);
2 changes: 1 addition & 1 deletion tests/references/divWithChildAndClassName.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var Inferno = require("inferno");
import * as Inferno from "inferno";
var createTextVNode = Inferno.createTextVNode;
var createVNode = Inferno.createVNode;
createVNode(1, "div", "first second", createTextVNode("1"), 2);
2 changes: 1 addition & 1 deletion tests/references/divWithChildExpression.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
var Inferno = require("inferno");
import * as Inferno from "inferno";
var createVNode = Inferno.createVNode;
createVNode(1, "div", null, test, 0);
2 changes: 1 addition & 1 deletion tests/references/divWithChildExpressionAdvanced.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var Inferno = require("inferno");
import * as Inferno from "inferno";
var createVNode = Inferno.createVNode;
createVNode(1, "div", null, false && [
createVNode(1, "div"),
Expand Down
2 changes: 1 addition & 1 deletion tests/references/divWithClassAsVariable.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var Inferno = require("inferno");
import * as Inferno from "inferno";
var createTextVNode = Inferno.createTextVNode;
var createVNode = Inferno.createVNode;
createVNode(1, "div", variable, createTextVNode("1"), 2);
2 changes: 1 addition & 1 deletion tests/references/divWithEvents.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var Inferno = require("inferno");
import * as Inferno from "inferno";
var createTextVNode = Inferno.createTextVNode;
var createVNode = Inferno.createVNode;
createVNode(1, "div", variable, createTextVNode("1"), 2, { "id": "test", "onClick": func });
2 changes: 1 addition & 1 deletion tests/references/divWithNoAssignedAttributes.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
var Inferno = require("inferno");
import * as Inferno from "inferno";
var createVNode = Inferno.createVNode;
createVNode(1, "div", null, null, 1, { "foo": true, "Bar": true, "STAR": true });
2 changes: 1 addition & 1 deletion tests/references/functionalComponentLifeCycle.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
var Inferno = require("inferno");
import * as Inferno from "inferno";
var createComponentVNode = Inferno.createComponentVNode;
createComponentVNode(2, FunctionalComponent, null, null, { "onComponentDidMount": mounted });
2 changes: 1 addition & 1 deletion tests/references/htmlFor.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
var Inferno = require("inferno");
import * as Inferno from "inferno";
var createVNode = Inferno.createVNode;
createVNode(1, "label", null, createVNode(64, "input", null, null, 1, { "id": id, "name": name, "value": value, "onChange": onChange, "onInput": onInput, "onKeyup": onKeyup, "onFocus": onFocus, "onClick": onClick, "type": "number", "pattern": "[0-9]+([,\\.][0-9]+)?", "inputMode": "numeric", "min": minimum }), 2, { "for": id });
2 changes: 1 addition & 1 deletion tests/references/specialFlags1.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
var Inferno = require("inferno");
import * as Inferno from "inferno";
var createVNode = Inferno.createVNode;
createVNode(1, "div", null, magic, 8);
2 changes: 1 addition & 1 deletion tests/references/specialFlags2.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
var Inferno = require("inferno");
import * as Inferno from "inferno";
var createVNode = Inferno.createVNode;
createVNode(1, "div", null, magic, 2);
2 changes: 1 addition & 1 deletion tests/references/specialFlags3.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var Inferno = require("inferno");
import * as Inferno from "inferno";
var createTextVNode = Inferno.createTextVNode;
var createVNode = Inferno.createVNode;
createVNode(1, "div", null, createTextVNode("text"), 2);
2 changes: 1 addition & 1 deletion tests/references/specialFlags4.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
var Inferno = require("inferno");
import * as Inferno from "inferno";
var createVNode = Inferno.createVNode;
createVNode(1, "div", null, test, 4);
2 changes: 1 addition & 1 deletion tests/references/specialFlags5.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
var Inferno = require("inferno");
import * as Inferno from "inferno";
var createVNode = Inferno.createVNode;
createVNode(2049, "div");
2 changes: 1 addition & 1 deletion tests/references/spreadAttribute1.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ var __assign = (this && this.__assign) || Object.assign || function(t) {
}
return t;
};
var Inferno = require("inferno");
import * as Inferno from "inferno";
var normalizeProps = Inferno.normalizeProps;
var createVNode = Inferno.createVNode;
normalizeProps(createVNode(1, "div", null, null, 1, __assign({}, props, { "foo": "bar" })));
2 changes: 1 addition & 1 deletion tests/references/spreadAttribute2.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ var __assign = (this && this.__assign) || Object.assign || function(t) {
}
return t;
};
var Inferno = require("inferno");
import * as Inferno from "inferno";
var normalizeProps = Inferno.normalizeProps;
var createVNode = Inferno.createVNode;
normalizeProps(createVNode(1, "div", null, null, 1, __assign({}, this.props, { "foo": "bar" })));
2 changes: 1 addition & 1 deletion tests/references/svgAttributeFillOpacity.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
var Inferno = require("inferno");
import * as Inferno from "inferno";
var createVNode = Inferno.createVNode;
createVNode(32, "svg", null, createVNode(1, "rect", null, null, 1, { "fill-opacity": "1" }), 2);
2 changes: 1 addition & 1 deletion tests/references/svgAttributeStrokeWidth.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
var Inferno = require("inferno");
import * as Inferno from "inferno";
var createVNode = Inferno.createVNode;
createVNode(32, "svg", null, createVNode(1, "rect", null, null, 1, { "stroke-width": "1px" }), 2);
2 changes: 1 addition & 1 deletion tests/references/svgAttributeXlinkHref.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
var Inferno = require("inferno");
import * as Inferno from "inferno";
var createVNode = Inferno.createVNode;
createVNode(32, "svg", null, createVNode(1, "use", null, null, 1, { "xlink:href": "#tester" }), 2);
2 changes: 1 addition & 1 deletion tests/references/unknownClass.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
var Inferno = require("inferno");
import * as Inferno from "inferno";
var createComponentVNode = Inferno.createComponentVNode;
createComponentVNode(2, UnkownClass, { "className": "first second", "children": "1" });
2 changes: 1 addition & 1 deletion tests/references/whitespaceAfterClosingTag.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var Inferno = require("inferno");
import * as Inferno from "inferno";
var createTextVNode = Inferno.createTextVNode;
var createVNode = Inferno.createVNode;
createVNode(1, "p", null, [createVNode(1, "span", null, createTextVNode("hello"), 2), createTextVNode(" world")], 4);

0 comments on commit 7be80ce

Please sign in to comment.