Skip to content

Commit e4c1b4b

Browse files
qburst-aparnaNoviny
authored andcommitted
Support module resolution (#72)
* Support module resolution * fix test * changeset update * add changeset
1 parent 907688c commit e4c1b4b

File tree

9 files changed

+20
-10
lines changed

9 files changed

+20
-10
lines changed

.changeset/3b448832/changes.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{ "releases": [{ "name": "extract-react-types-loader", "type": "patch" }], "dependents": [] }

.changeset/3b448832/changes.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
- Added support for loading modules from src as well as node_modules
2+
3+

.changeset/46f8a575/changes.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{ "releases": [{ "name": "extract-react-types", "type": "patch" }], "dependents": [] }

.changeset/46f8a575/changes.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- Changed the babel-explode-module to be referenced from @aparna036/babel-explode-module which has the opaque type
2+
variable declaration support.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"^.+\\.jsx?$": "babel-jest"
3333
},
3434
"dependencies": {
35+
"@aparna036/babel-explode-module": "^2.0.1",
3536
"@babel/core": "^7.4.4",
3637
"@babel/plugin-syntax-flow": "^7.2.0",
3738
"@babel/plugin-syntax-jsx": "^7.2.0",
@@ -42,7 +43,6 @@
4243
"ast-pretty-print": "^2.0.1",
4344
"babel-errors": "^1.1.1",
4445
"babel-eslint": "^10.0.1",
45-
"babel-explode-module": "^3.0.0",
4646
"babel-file": "^3.0.0",
4747
"babel-file-loader": "^2.0.0",
4848
"babel-flow-identifiers": "^1.1.3",

packages/extract-react-types-loader/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ module.exports = function extractReactTypesLoader(content /* : string */) {
5151
return location.replace(dist, pkg['atlaskit:src']);
5252
}
5353
return null;
54-
}
54+
},
55+
/*This is here for instances where there are paths which are not packages */
56+
moduleDirectory: ['node_modules', 'src']
5557
};
5658

5759
const types = extractReactTypes(content, typeSystem, filename, resolveOpts);

packages/extract-react-types/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@
1818
"documentation"
1919
],
2020
"dependencies": {
21+
"@aparna036/babel-explode-module": "^2.0.1",
2122
"@babel/core": "^7.4.4",
2223
"@babel/runtime": "^7.4.4",
2324
"@babel/types": "^7.0.0-beta.56",
2425
"ast-pretty-print": "^2.0.1",
2526
"babel-errors": "^1.1.1",
26-
"babel-explode-module": "^3.0.0",
2727
"babel-file": "^3.0.0",
2828
"babel-file-loader": "^2.0.0",
2929
"babel-flow-identifiers": "^1.1.3",

packages/extract-react-types/src/matchExported.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// @flow
2-
import { explodeModule } from 'babel-explode-module';
2+
import { explodeModule } from '@aparna036/babel-explode-module';
33
import { explodedToStatements } from 'babel-helper-simplify-module';
44
// $FlowFixMe
55
import printAST from 'ast-pretty-print';

yarn.lock

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22
# yarn lockfile v1
33

44

5+
"@aparna036/babel-explode-module@^2.0.1":
6+
version "2.0.1"
7+
resolved "https://registry.yarnpkg.com/@aparna036/babel-explode-module/-/babel-explode-module-2.0.1.tgz#a6584580466b3256390fbd17fb2a6d9aab8b237f"
8+
integrity sha512-0E7h/wnIyH2ReiS2+S9FchNcssVQclrFgOBKdpQR5iiwrZq5pAkSz8R2IKy0qaJNLPvIucSaL3rLHQenlC8RPw==
9+
dependencies:
10+
"@babel/types" "^7.0.0-beta.56"
11+
512
"@babel/code-frame@^7.0.0":
613
version "7.0.0"
714
resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0.tgz#06e2ab19bdb535385559aabb5ba59729482800f8"
@@ -1305,12 +1312,6 @@ babel-explode-module@^1.4.0:
13051312
dependencies:
13061313
babel-types "^6.24.1"
13071314

1308-
babel-explode-module@^3.0.0:
1309-
version "3.0.0"
1310-
resolved "https://registry.yarnpkg.com/babel-explode-module/-/babel-explode-module-3.0.0.tgz#5989f6db02d205ca538f514ba0b9108d43590f6d"
1311-
dependencies:
1312-
"@babel/types" "^7.0.0-beta.56"
1313-
13141315
babel-file-loader@^2.0.0:
13151316
version "2.0.0"
13161317
resolved "https://registry.yarnpkg.com/babel-file-loader/-/babel-file-loader-2.0.0.tgz#5c38d51d1baf1e5a0c896bbf551cd083ef194a6d"

0 commit comments

Comments
 (0)