@zohodesk/react-cli 1.1.21 → 1.1.22-exp.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -23,7 +23,7 @@ const {
23
23
  const isProd = mode.toLowerCase() === 'prod';
24
24
  const defaultPlugins = [[require.resolve('babel-plugin-transform-define'), isProd ? {
25
25
  __DOCS__: false
26
- } : {}], require.resolve('@babel/plugin-syntax-dynamic-import')];
26
+ } : {}], require.resolve('@babel/plugin-syntax-dynamic-import'), require.resolve('../utils/addModulePathAlias')];
27
27
  const resolvedPlugins = [];
28
28
  babelPlugins.forEach(plugin => {
29
29
  resolvedPlugins.push(require.resolve(plugin));
@@ -24,7 +24,7 @@ const {
24
24
  const isProd = mode.toLowerCase() === 'prod';
25
25
  const defaultPlugins = [[require.resolve('babel-plugin-transform-define'), isProd ? {
26
26
  __DOCS__: false
27
- } : {}], require.resolve('@babel/plugin-syntax-dynamic-import')];
27
+ } : {}], require.resolve('@babel/plugin-syntax-dynamic-import'), require.resolve('../utils/addModulePathAlias')];
28
28
  const resolvedPlugins = [];
29
29
  babelPlugins.forEach(plugin => {
30
30
  resolvedPlugins.push(require.resolve(plugin));
@@ -21,6 +21,7 @@ function moduleResolver(options) {
21
21
  moduleResolvePath,
22
22
  disableES5Transpile
23
23
  } = options.app;
24
+ const customAlias = options.app.alias;
24
25
  let required = moduleResolvePath && (0, _requireLocalOrGlobal.requireLocal)(moduleResolvePath);
25
26
 
26
27
  if (!required) {
@@ -32,9 +33,11 @@ function moduleResolver(options) {
32
33
  }
33
34
 
34
35
  const nodeModulesPath = required ? required.nodeModulesPath : _client_packages_group.nodeModulesPath;
36
+ const totalAlias = Object.assign({}, _libAlias.libAlias, customAlias);
35
37
  return {
38
+ extensions: ['.js', '.jsx', '.ts', '.tsx'],
36
39
  modules: [nodeModulesPath, _constants.cliNodeModulesPath, 'node_modules'].filter(Boolean),
37
- alias: disableES5Transpile ? _libAlias.libAlias : {} // alias: { ...libAlias, ...clientDependenies }
40
+ alias: disableES5Transpile ? totalAlias : {} // alias: { ...libAlias, ...clientDependenies }
38
41
 
39
42
  };
40
43
  }
@@ -125,6 +125,7 @@ var _default = {
125
125
  cssDirStatement: null
126
126
  },
127
127
  app: {
128
+ alias: {},
128
129
  moduleResolvePath: {
129
130
  value: '@zohodesk/client_packages_group',
130
131
  cli: 'module_resolve_path'
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+
3
+ var _getOptions = _interopRequireDefault(require("./getOptions"));
4
+
5
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6
+
7
+ const options = (0, _getOptions.default)();
8
+ const alias = options.app.alias;
9
+
10
+ module.exports = () => ({
11
+ visitor: {
12
+ ImportDeclaration(path) {
13
+ const source = path.node.source.value;
14
+ const aliasName = Object.keys(alias);
15
+ aliasName.forEach(name => {
16
+ if (source.includes(name)) {
17
+ path.node.source.value = source.replace(name, alias[name]);
18
+ }
19
+ });
20
+ }
21
+
22
+ }
23
+ });
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@zohodesk/react-cli",
3
- "version": "1.1.21",
3
+ "version": "1.1.22",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@zohodesk/react-cli",
9
- "version": "1.1.21",
9
+ "version": "1.1.22",
10
10
  "license": "ISC",
11
11
  "dependencies": {
12
12
  "@babel/cli": "7.10.5",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/react-cli",
3
- "version": "1.1.21",
3
+ "version": "1.1.22-exp.2",
4
4
  "description": "A CLI tool for build modern web application and libraries",
5
5
  "scripts": {
6
6
  "init": "node ./lib/utils/init.js",