Skip to content
This repository has been archived by the owner on Apr 9, 2020. It is now read-only.

Commit

Permalink
Fix for Node 0.10
Browse files Browse the repository at this point in the history
  • Loading branch information
gaearon committed Sep 4, 2015
1 parent 7cbad3e commit d0c5782
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,8 @@
"react",
"reactjs",
"components"
]
],
"dependencies": {
"path-parse": "^1.0.5"
}
}
11 changes: 6 additions & 5 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import path from 'path';
import parsePath from 'path-parse';

export default function ({ Plugin, types: t }) {
const parentDir = path.resolve(path.join(__dirname, '..', '..'));
Expand All @@ -24,9 +25,9 @@ export default function ({ Plugin, types: t }) {
resolvePathAssumingWeAreInNodeModules :
resolvePathConservatively;

const depthKey = Symbol('depth');
const recordsKey = Symbol('records');
const wrapComponentIdKey = Symbol('wrapComponentId');
const depthKey = '__reactTransformDepth';
const recordsKey = '__reactTransformRecords';
const wrapComponentIdKey = '__reactTransformWrapComponentId';

function isRenderMethod(member) {
return member.kind === 'method' &&
Expand Down Expand Up @@ -173,8 +174,8 @@ export default function ({ Plugin, types: t }) {
const { filename } = file.opts;

function isSameAsFileBeingProcessed(importPath) {
const { dir, base, ext, name } = path.parse(resolvePath(importPath, filename));
return dir === '.' && name === path.parse(filename).name;
const { dir, base, ext, name } = parsePath(resolvePath(importPath, filename));
return dir === '.' && name === parsePath(filename).name;
}

if (imports.some(isSameAsFileBeingProcessed)) {
Expand Down

0 comments on commit d0c5782

Please sign in to comment.