@modern-js/server-utils 2.26.1-alpha.1 → 2.28.0

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.
Files changed (156) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/dist/cjs/common/index.js +2 -2
  3. package/dist/cjs/compilers/babel/preset/alias.js +2 -2
  4. package/dist/cjs/compilers/typescript/tsconfigPathsPlugin.js +2 -2
  5. package/dist/esm/common/index.js +2 -2
  6. package/dist/esm/compilers/babel/preset/alias.js +2 -2
  7. package/dist/esm/compilers/typescript/tsconfigPathsPlugin.js +2 -2
  8. package/dist/esm-node/common/index.js +2 -2
  9. package/dist/esm-node/compilers/babel/preset/alias.js +2 -2
  10. package/dist/esm-node/compilers/typescript/tsconfigPathsPlugin.js +2 -2
  11. package/package.json +11 -19
  12. package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/src/index.js +0 -56
  13. package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/src/log.js +0 -13
  14. package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/src/mapPath.js +0 -28
  15. package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/src/mapToRelative.js +0 -21
  16. package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/src/normalizeOptions.js +0 -157
  17. package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/src/resolvePath.js +0 -92
  18. package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/src/transformers/call.js +0 -24
  19. package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/src/transformers/import.js +0 -19
  20. package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/src/utils.js +0 -98
  21. package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/test/call.test.js +0 -92
  22. package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/test/custom-call.test.js +0 -73
  23. package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/test/dynamicImport.test.js +0 -74
  24. package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/test/import.test.js +0 -118
  25. package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/test/index.test.js +0 -863
  26. package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/test/mapToRelative.test.js +0 -21
  27. package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/test/normalizeOptions.test.js +0 -50
  28. package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/example-file.js +0 -1
  29. package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/node_modules/first/index.js +0 -1
  30. package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/node_modules/second/index.js +0 -1
  31. package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/package.json +0 -1
  32. package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/actions/something.js +0 -1
  33. package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/app.js +0 -1
  34. package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/components/App.js +0 -1
  35. package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/components/Header/SubHeader.js +0 -1
  36. package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/components/Header/header.css +0 -0
  37. package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/components/Header/index.js +0 -1
  38. package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/components/Root.js +0 -1
  39. package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/components/Sidebar/Footer/SidebarFooterButton.js +0 -1
  40. package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/components/Sidebar/Footer/index.js +0 -1
  41. package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/components/index.js +0 -1
  42. package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/constants/actions.js +0 -1
  43. package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/constants.js +0 -1
  44. package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/libs/custom.modernizr3.js +0 -1
  45. package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/nodemodule.js +0 -1
  46. package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/rn/index.android.js +0 -1
  47. package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/rn/index.ios.js +0 -1
  48. package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/test/tools.js +0 -12
  49. package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/src/index.js +0 -41
  50. package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/src/log.js +0 -8
  51. package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/src/mapPath.js +0 -17
  52. package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/src/mapToRelative.js +0 -10
  53. package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/src/normalizeOptions.js +0 -162
  54. package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/src/resolvePath.js +0 -86
  55. package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/src/transformers/call.js +0 -15
  56. package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/src/transformers/import.js +0 -8
  57. package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/src/utils.js +0 -57
  58. package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/test/call.test.js +0 -87
  59. package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/test/custom-call.test.js +0 -68
  60. package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/test/dynamicImport.test.js +0 -71
  61. package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/test/import.test.js +0 -124
  62. package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/test/index.test.js +0 -862
  63. package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/test/mapToRelative.test.js +0 -16
  64. package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/test/normalizeOptions.test.js +0 -45
  65. package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/example-file.js +0 -0
  66. package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/node_modules/first/index.js +0 -0
  67. package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/node_modules/second/index.js +0 -0
  68. package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/package.json +0 -1
  69. package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/actions/something.js +0 -0
  70. package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/app.js +0 -0
  71. package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/components/App.js +0 -0
  72. package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/components/Header/SubHeader.js +0 -0
  73. package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/components/Header/header.css +0 -0
  74. package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/components/Header/index.js +0 -0
  75. package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/components/Root.js +0 -0
  76. package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/components/Sidebar/Footer/SidebarFooterButton.js +0 -0
  77. package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/components/Sidebar/Footer/index.js +0 -0
  78. package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/components/index.js +0 -0
  79. package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/constants/actions.js +0 -0
  80. package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/constants.js +0 -0
  81. package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/libs/custom.modernizr3.js +0 -0
  82. package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/nodemodule.js +0 -0
  83. package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/rn/index.android.js +0 -0
  84. package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/rn/index.ios.js +0 -0
  85. package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/test/tools.js +0 -2
  86. package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/src/index.js +0 -37
  87. package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/src/log.js +0 -3
  88. package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/src/mapPath.js +0 -17
  89. package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/src/mapToRelative.js +0 -10
  90. package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/src/normalizeOptions.js +0 -146
  91. package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/src/resolvePath.js +0 -81
  92. package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/src/transformers/call.js +0 -13
  93. package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/src/transformers/import.js +0 -8
  94. package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/src/utils.js +0 -57
  95. package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/test/call.test.js +0 -87
  96. package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/test/custom-call.test.js +0 -68
  97. package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/test/dynamicImport.test.js +0 -69
  98. package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/test/import.test.js +0 -113
  99. package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/test/index.test.js +0 -857
  100. package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/test/mapToRelative.test.js +0 -16
  101. package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/test/normalizeOptions.test.js +0 -45
  102. package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/example-file.js +0 -0
  103. package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/node_modules/first/index.js +0 -0
  104. package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/node_modules/second/index.js +0 -0
  105. package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/package.json +0 -1
  106. package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/actions/something.js +0 -0
  107. package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/app.js +0 -0
  108. package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/components/App.js +0 -0
  109. package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/components/Header/SubHeader.js +0 -0
  110. package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/components/Header/header.css +0 -0
  111. package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/components/Header/index.js +0 -0
  112. package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/components/Root.js +0 -0
  113. package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/components/Sidebar/Footer/SidebarFooterButton.js +0 -0
  114. package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/components/Sidebar/Footer/index.js +0 -0
  115. package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/components/index.js +0 -0
  116. package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/constants/actions.js +0 -0
  117. package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/constants.js +0 -0
  118. package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/libs/custom.modernizr3.js +0 -0
  119. package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/nodemodule.js +0 -0
  120. package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/rn/index.android.js +0 -0
  121. package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/rn/index.ios.js +0 -0
  122. package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/test/tools.js +0 -2
  123. package/dist/types/compilers/babel/plugins/babel-plugin-module-resolver/src/index.d.ts +0 -19
  124. package/dist/types/compilers/babel/plugins/babel-plugin-module-resolver/src/log.d.ts +0 -1
  125. package/dist/types/compilers/babel/plugins/babel-plugin-module-resolver/src/mapPath.d.ts +0 -1
  126. package/dist/types/compilers/babel/plugins/babel-plugin-module-resolver/src/mapToRelative.d.ts +0 -1
  127. package/dist/types/compilers/babel/plugins/babel-plugin-module-resolver/src/normalizeOptions.d.ts +0 -24
  128. package/dist/types/compilers/babel/plugins/babel-plugin-module-resolver/src/resolvePath.d.ts +0 -1
  129. package/dist/types/compilers/babel/plugins/babel-plugin-module-resolver/src/transformers/call.d.ts +0 -1
  130. package/dist/types/compilers/babel/plugins/babel-plugin-module-resolver/src/transformers/import.d.ts +0 -1
  131. package/dist/types/compilers/babel/plugins/babel-plugin-module-resolver/src/utils.d.ts +0 -9
  132. package/dist/types/compilers/babel/plugins/babel-plugin-module-resolver/test/call.test.d.ts +0 -1
  133. package/dist/types/compilers/babel/plugins/babel-plugin-module-resolver/test/custom-call.test.d.ts +0 -1
  134. package/dist/types/compilers/babel/plugins/babel-plugin-module-resolver/test/dynamicImport.test.d.ts +0 -1
  135. package/dist/types/compilers/babel/plugins/babel-plugin-module-resolver/test/import.test.d.ts +0 -1
  136. package/dist/types/compilers/babel/plugins/babel-plugin-module-resolver/test/index.test.d.ts +0 -1
  137. package/dist/types/compilers/babel/plugins/babel-plugin-module-resolver/test/mapToRelative.test.d.ts +0 -1
  138. package/dist/types/compilers/babel/plugins/babel-plugin-module-resolver/test/normalizeOptions.test.d.ts +0 -1
  139. package/dist/types/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/example-file.d.ts +0 -0
  140. package/dist/types/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/actions/something.d.ts +0 -0
  141. package/dist/types/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/app.d.ts +0 -0
  142. package/dist/types/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/components/App.d.ts +0 -0
  143. package/dist/types/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/components/Header/SubHeader.d.ts +0 -0
  144. package/dist/types/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/components/Header/index.d.ts +0 -0
  145. package/dist/types/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/components/Root.d.ts +0 -0
  146. package/dist/types/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/components/Sidebar/Footer/SidebarFooterButton.d.ts +0 -0
  147. package/dist/types/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/components/Sidebar/Footer/index.d.ts +0 -0
  148. package/dist/types/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/components/index.d.ts +0 -0
  149. package/dist/types/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/constants/actions.d.ts +0 -0
  150. package/dist/types/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/constants.d.ts +0 -0
  151. package/dist/types/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/libs/custom.modernizr3.d.ts +0 -0
  152. package/dist/types/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/nodemodule.d.mts +0 -1
  153. package/dist/types/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/rn/index.android.d.ts +0 -0
  154. package/dist/types/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/rn/index.ios.d.ts +0 -0
  155. package/dist/types/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/test/tools.d.ts +0 -1
  156. package/test-setup.js +0 -7
package/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # @modern-js/server-utils
2
2
 
3
+ ## 2.28.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [ba9387f]
8
+ - Updated dependencies [00b58a7]
9
+ - @modern-js/babel-plugin-module-resolver@2.28.0
10
+ - @modern-js/utils@2.28.0
11
+ - @modern-js/babel-preset-base@2.28.0
12
+ - @modern-js/babel-compiler@2.28.0
13
+
14
+ ## 2.27.0
15
+
16
+ ### Patch Changes
17
+
18
+ - Updated dependencies [91d14b8]
19
+ - Updated dependencies [8322a51]
20
+ - Updated dependencies [6d7104d]
21
+ - @modern-js/utils@2.27.0
22
+ - @modern-js/babel-compiler@2.27.0
23
+ - @modern-js/babel-preset-base@2.27.0
24
+ - @modern-js/babel-plugin-module-resolver@2.27.0
25
+
3
26
  ## 2.26.0
4
27
 
5
28
  ### Patch Changes
@@ -35,11 +35,11 @@ const validateAbsolutePaths = (filenames, messageFunc) => {
35
35
  filenames.forEach((filename) => validateAbsolutePath(filename, messageFunc(filename)));
36
36
  };
37
37
  const compile = async (appDirectory, modernConfig, compileOptions) => {
38
- var _modernConfig_server;
38
+ var _modernConfig_server, _modernConfig;
39
39
  const { sourceDirs, distDir, tsconfigPath } = compileOptions;
40
40
  validateAbsolutePaths(sourceDirs, (dir) => `source dir ${dir} is not an absolute path.`);
41
41
  validateAbsolutePath(distDir, `dist dir ${distDir} is not an absolute path.`);
42
- const compiler = modernConfig === null || modernConfig === void 0 ? void 0 : (_modernConfig_server = modernConfig.server) === null || _modernConfig_server === void 0 ? void 0 : _modernConfig_server.compiler;
42
+ const compiler = (_modernConfig = modernConfig) === null || _modernConfig === void 0 ? void 0 : (_modernConfig_server = _modernConfig.server) === null || _modernConfig_server === void 0 ? void 0 : _modernConfig_server.compiler;
43
43
  const isTsProject = tsconfigPath && await _utils.fs.pathExists(tsconfigPath);
44
44
  if (!isTsProject || compiler === "babel") {
45
45
  const { compileByBabel } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("../compilers/babel")));
@@ -12,7 +12,7 @@ const _interop_require_default = require("@swc/helpers/_/_interop_require_defaul
12
12
  const _path = /* @__PURE__ */ _interop_require_default._(require("path"));
13
13
  const _tsconfigpaths = require("@modern-js/utils/tsconfig-paths");
14
14
  const _utils = require("@modern-js/utils");
15
- const { resolvePath } = require("../plugins/babel-plugin-module-resolver/src");
15
+ const { resolvePath } = require("@modern-js/babel-plugin-module-resolver");
16
16
  const defaultPaths = {
17
17
  "@": [
18
18
  "./src"
@@ -73,7 +73,7 @@ const aliasPlugin = (alias) => {
73
73
  ".mjs"
74
74
  ];
75
75
  return [
76
- "../plugins/babel-plugin-module-resolver/src",
76
+ "@modern-js/babel-plugin-module-resolver",
77
77
  {
78
78
  root: absoluteBaseUrl,
79
79
  alias: mergedPaths,
@@ -102,8 +102,8 @@ function tsconfigPathsBeforeHookFactory(tsBinary, baseUrl, paths) {
102
102
  }
103
103
  if (tsBinary.isImportDeclaration(node) || tsBinary.isExportDeclaration(node) && node.moduleSpecifier) {
104
104
  try {
105
- var _node_moduleSpecifier;
106
- const importPathWithQuotes = node === null || node === void 0 ? void 0 : (_node_moduleSpecifier = node.moduleSpecifier) === null || _node_moduleSpecifier === void 0 ? void 0 : _node_moduleSpecifier.getText();
105
+ var _node_moduleSpecifier, _node;
106
+ const importPathWithQuotes = (_node = node) === null || _node === void 0 ? void 0 : (_node_moduleSpecifier = _node.moduleSpecifier) === null || _node_moduleSpecifier === void 0 ? void 0 : _node_moduleSpecifier.getText();
107
107
  if (!importPathWithQuotes) {
108
108
  return node;
109
109
  }
@@ -20,7 +20,7 @@ var validateAbsolutePaths = function(filenames, messageFunc) {
20
20
  };
21
21
  export var compile = function() {
22
22
  var _ref = _async_to_generator(function(appDirectory, modernConfig, compileOptions) {
23
- var _modernConfig_server, sourceDirs, distDir, tsconfigPath, compiler, isTsProject, _tmp, compileByBabel, compileByTs;
23
+ var _modernConfig_server, _modernConfig, sourceDirs, distDir, tsconfigPath, compiler, isTsProject, _tmp, compileByBabel, compileByTs;
24
24
  return _ts_generator(this, function(_state) {
25
25
  switch (_state.label) {
26
26
  case 0:
@@ -29,7 +29,7 @@ export var compile = function() {
29
29
  return "source dir ".concat(dir, " is not an absolute path.");
30
30
  });
31
31
  validateAbsolutePath(distDir, "dist dir ".concat(distDir, " is not an absolute path."));
32
- compiler = modernConfig === null || modernConfig === void 0 ? void 0 : (_modernConfig_server = modernConfig.server) === null || _modernConfig_server === void 0 ? void 0 : _modernConfig_server.compiler;
32
+ compiler = (_modernConfig = modernConfig) === null || _modernConfig === void 0 ? void 0 : (_modernConfig_server = _modernConfig.server) === null || _modernConfig_server === void 0 ? void 0 : _modernConfig_server.compiler;
33
33
  _tmp = tsconfigPath;
34
34
  if (!_tmp)
35
35
  return [
@@ -4,7 +4,7 @@ import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
4
4
  import path from "path";
5
5
  import { createMatchPath } from "@modern-js/utils/tsconfig-paths";
6
6
  import { getUserAlias } from "@modern-js/utils";
7
- var resolvePath = require("../plugins/babel-plugin-module-resolver/src").resolvePath;
7
+ var resolvePath = require("@modern-js/babel-plugin-module-resolver").resolvePath;
8
8
  var defaultPaths = {
9
9
  "@": [
10
10
  "./src"
@@ -56,7 +56,7 @@ export var aliasPlugin = function(alias) {
56
56
  ".mjs"
57
57
  ];
58
58
  return [
59
- "../plugins/babel-plugin-module-resolver/src",
59
+ "@modern-js/babel-plugin-module-resolver",
60
60
  {
61
61
  root: absoluteBaseUrl,
62
62
  alias: mergedPaths,
@@ -111,8 +111,8 @@ export function tsconfigPathsBeforeHookFactory(tsBinary, baseUrl, paths) {
111
111
  }
112
112
  if (tsBinary.isImportDeclaration(node) || tsBinary.isExportDeclaration(node) && node.moduleSpecifier) {
113
113
  try {
114
- var _node_moduleSpecifier;
115
- var importPathWithQuotes1 = node === null || node === void 0 ? void 0 : (_node_moduleSpecifier = node.moduleSpecifier) === null || _node_moduleSpecifier === void 0 ? void 0 : _node_moduleSpecifier.getText();
114
+ var _node_moduleSpecifier, _node;
115
+ var importPathWithQuotes1 = (_node = node) === null || _node === void 0 ? void 0 : (_node_moduleSpecifier = _node.moduleSpecifier) === null || _node_moduleSpecifier === void 0 ? void 0 : _node_moduleSpecifier.getText();
116
116
  if (!importPathWithQuotes1) {
117
117
  return node;
118
118
  }
@@ -15,11 +15,11 @@ const validateAbsolutePaths = (filenames, messageFunc) => {
15
15
  filenames.forEach((filename) => validateAbsolutePath(filename, messageFunc(filename)));
16
16
  };
17
17
  export const compile = async (appDirectory, modernConfig, compileOptions) => {
18
- var _modernConfig_server;
18
+ var _modernConfig_server, _modernConfig;
19
19
  const { sourceDirs, distDir, tsconfigPath } = compileOptions;
20
20
  validateAbsolutePaths(sourceDirs, (dir) => `source dir ${dir} is not an absolute path.`);
21
21
  validateAbsolutePath(distDir, `dist dir ${distDir} is not an absolute path.`);
22
- const compiler = modernConfig === null || modernConfig === void 0 ? void 0 : (_modernConfig_server = modernConfig.server) === null || _modernConfig_server === void 0 ? void 0 : _modernConfig_server.compiler;
22
+ const compiler = (_modernConfig = modernConfig) === null || _modernConfig === void 0 ? void 0 : (_modernConfig_server = _modernConfig.server) === null || _modernConfig_server === void 0 ? void 0 : _modernConfig_server.compiler;
23
23
  const isTsProject = tsconfigPath && await fs.pathExists(tsconfigPath);
24
24
  if (!isTsProject || compiler === "babel") {
25
25
  const { compileByBabel } = await import("../compilers/babel");
@@ -1,7 +1,7 @@
1
1
  import path from "path";
2
2
  import { createMatchPath } from "@modern-js/utils/tsconfig-paths";
3
3
  import { getUserAlias } from "@modern-js/utils";
4
- const { resolvePath } = require("../plugins/babel-plugin-module-resolver/src");
4
+ const { resolvePath } = require("@modern-js/babel-plugin-module-resolver");
5
5
  const defaultPaths = {
6
6
  "@": [
7
7
  "./src"
@@ -62,7 +62,7 @@ export const aliasPlugin = (alias) => {
62
62
  ".mjs"
63
63
  ];
64
64
  return [
65
- "../plugins/babel-plugin-module-resolver/src",
65
+ "@modern-js/babel-plugin-module-resolver",
66
66
  {
67
67
  root: absoluteBaseUrl,
68
68
  alias: mergedPaths,
@@ -91,8 +91,8 @@ export function tsconfigPathsBeforeHookFactory(tsBinary, baseUrl, paths) {
91
91
  }
92
92
  if (tsBinary.isImportDeclaration(node) || tsBinary.isExportDeclaration(node) && node.moduleSpecifier) {
93
93
  try {
94
- var _node_moduleSpecifier;
95
- const importPathWithQuotes = node === null || node === void 0 ? void 0 : (_node_moduleSpecifier = node.moduleSpecifier) === null || _node_moduleSpecifier === void 0 ? void 0 : _node_moduleSpecifier.getText();
94
+ var _node_moduleSpecifier, _node;
95
+ const importPathWithQuotes = (_node = node) === null || _node === void 0 ? void 0 : (_node_moduleSpecifier = _node.moduleSpecifier) === null || _node_moduleSpecifier === void 0 ? void 0 : _node_moduleSpecifier.getText();
96
96
  if (!importPathWithQuotes) {
97
97
  return node;
98
98
  }
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "2.26.1-alpha.1",
18
+ "version": "2.28.0",
19
19
  "jsnext:source": "./src/index.ts",
20
20
  "types": "./dist/types/index.d.ts",
21
21
  "main": "./dist/cjs/index.js",
@@ -31,36 +31,28 @@
31
31
  }
32
32
  },
33
33
  "dependencies": {
34
+ "@babel/core": "^7.21.8",
34
35
  "@babel/plugin-proposal-class-properties": "^7.18.6",
35
36
  "@babel/plugin-proposal-decorators": "^7.21.0",
37
+ "@babel/preset-env": "^7.21.5",
36
38
  "@babel/preset-typescript": "^7.21.5",
37
- "@swc/helpers": "0.5.1",
38
- "babel-plugin-module-resolver": "^4.1.0",
39
39
  "babel-plugin-transform-typescript-metadata": "^0.3.2",
40
- "glob": "7.2.0",
41
- "pkg-up": "3.1.0",
42
- "reselect": "^4.1.8",
43
- "resolve": "^1.22.2",
44
- "@modern-js/utils": "2.26.0",
45
- "@modern-js/babel-preset-base": "2.26.0",
46
- "@modern-js/babel-compiler": "2.26.0"
40
+ "@swc/helpers": "0.5.1",
41
+ "@modern-js/babel-compiler": "2.28.0",
42
+ "@modern-js/babel-preset-base": "2.28.0",
43
+ "@modern-js/utils": "2.28.0",
44
+ "@modern-js/babel-plugin-module-resolver": "2.28.0"
47
45
  },
48
46
  "devDependencies": {
49
- "@babel/core": "^7.21.8",
50
- "@babel/plugin-syntax-dynamic-import": "^7.8.3",
51
- "@babel/plugin-transform-modules-commonjs": "^7.17.7",
52
- "@babel/preset-env": "^7.21.5",
53
47
  "@types/babel__core": "^7.20.0",
54
48
  "@types/jest": "^29",
55
49
  "@types/node": "^14",
56
- "babel-core": "^6.26.3",
57
- "common-tags": "^1.8.2",
58
50
  "jest": "^29",
59
51
  "ts-jest": "^29.1.0",
60
52
  "typescript": "^5",
61
- "@modern-js/server-core": "2.26.0",
62
- "@scripts/jest-config": "2.26.0",
63
- "@scripts/build": "2.26.0"
53
+ "@modern-js/server-core": "2.28.0",
54
+ "@scripts/build": "2.28.0",
55
+ "@scripts/jest-config": "2.28.0"
64
56
  },
65
57
  "sideEffects": false,
66
58
  "publishConfig": {
@@ -1,56 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- function _export(target, all) {
6
- for (var name in all)
7
- Object.defineProperty(target, name, {
8
- enumerable: true,
9
- get: all[name]
10
- });
11
- }
12
- _export(exports, {
13
- resolvePath: function() {
14
- return _resolvePath.default;
15
- },
16
- default: function() {
17
- return _default;
18
- }
19
- });
20
- const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
21
- const _normalizeOptions = /* @__PURE__ */ _interop_require_default._(require("./normalizeOptions"));
22
- const _resolvePath = /* @__PURE__ */ _interop_require_default._(require("./resolvePath"));
23
- const _call = /* @__PURE__ */ _interop_require_default._(require("./transformers/call"));
24
- const _import = /* @__PURE__ */ _interop_require_default._(require("./transformers/import"));
25
- const importVisitors = {
26
- CallExpression: _call.default,
27
- "ImportDeclaration|ExportDeclaration": _import.default
28
- };
29
- const visitor = {
30
- Program: {
31
- enter(programPath, state) {
32
- programPath.traverse(importVisitors, state);
33
- },
34
- exit(programPath, state) {
35
- programPath.traverse(importVisitors, state);
36
- }
37
- }
38
- };
39
- const _default = ({ types }) => ({
40
- name: "module-resolver",
41
- manipulateOptions(opts) {
42
- if (opts.filename === void 0) {
43
- opts.filename = "unknown";
44
- }
45
- },
46
- pre(file) {
47
- this.types = types;
48
- const currentFile = file.opts.filename;
49
- this.normalizedOpts = (0, _normalizeOptions.default)(currentFile, this.opts);
50
- this.moduleResolverVisited = /* @__PURE__ */ new Set();
51
- },
52
- visitor,
53
- post() {
54
- this.moduleResolverVisited.clear();
55
- }
56
- });
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "warn", {
6
- enumerable: true,
7
- get: function() {
8
- return warn;
9
- }
10
- });
11
- function warn(...args) {
12
- console.warn(...args);
13
- }
@@ -1,28 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "default", {
6
- enumerable: true,
7
- get: function() {
8
- return mapPathString;
9
- }
10
- });
11
- const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
12
- const _resolvePath = /* @__PURE__ */ _interop_require_default._(require("./resolvePath"));
13
- function mapPathString(nodePath, state) {
14
- if (!state.types.isStringLiteral(nodePath)) {
15
- return;
16
- }
17
- const sourcePath = nodePath.node.value;
18
- const currentFile = state.file.opts.filename;
19
- const resolvePath = state.normalizedOpts.customResolvePath || _resolvePath.default;
20
- const modulePath = resolvePath(sourcePath, currentFile, state.opts);
21
- if (modulePath) {
22
- if (nodePath.node.pathResolved) {
23
- return;
24
- }
25
- nodePath.replaceWith(state.types.stringLiteral(modulePath));
26
- nodePath.node.pathResolved = true;
27
- }
28
- }
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "default", {
6
- enumerable: true,
7
- get: function() {
8
- return mapToRelative;
9
- }
10
- });
11
- const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
12
- const _path = /* @__PURE__ */ _interop_require_default._(require("path"));
13
- const _utils = require("./utils");
14
- function mapToRelative(cwd, currentFile, module) {
15
- let from = _path.default.dirname(currentFile);
16
- let to = _path.default.normalize(module);
17
- from = _path.default.resolve(cwd, from);
18
- to = _path.default.resolve(cwd, to);
19
- const moduleMapped = _path.default.relative(from, to);
20
- return (0, _utils.toPosixPath)(moduleMapped);
21
- }
@@ -1,157 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "default", {
6
- enumerable: true,
7
- get: function() {
8
- return _default;
9
- }
10
- });
11
- const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
12
- const _fs = /* @__PURE__ */ _interop_require_default._(require("fs"));
13
- const _path = /* @__PURE__ */ _interop_require_default._(require("path"));
14
- const _reselect = require("reselect");
15
- const _findbabelconfig = /* @__PURE__ */ _interop_require_default._(require("find-babel-config"));
16
- const _glob = /* @__PURE__ */ _interop_require_default._(require("glob"));
17
- const _pkgup = /* @__PURE__ */ _interop_require_default._(require("pkg-up"));
18
- const _utils = require("./utils");
19
- const defaultExtensions = [
20
- ".js",
21
- ".jsx",
22
- ".es",
23
- ".es6",
24
- ".mjs"
25
- ];
26
- const defaultTransformedFunctions = [
27
- "require",
28
- "require.resolve",
29
- "System.import",
30
- // Jest methods
31
- "jest.genMockFromModule",
32
- "jest.mock",
33
- "jest.unmock",
34
- "jest.doMock",
35
- "jest.dontMock",
36
- "jest.setMock",
37
- "jest.requireActual",
38
- "jest.requireMock",
39
- // Older Jest methods
40
- "require.requireActual",
41
- "require.requireMock"
42
- ];
43
- function isRegExp(string) {
44
- return string.startsWith("^") || string.endsWith("$");
45
- }
46
- const specialCwd = {
47
- babelrc: (startPath) => _findbabelconfig.default.sync(startPath).file,
48
- packagejson: (startPath) => _pkgup.default.sync({
49
- cwd: startPath
50
- })
51
- };
52
- function normalizeCwd(optsCwd, currentFile) {
53
- let cwd;
54
- if (optsCwd in specialCwd) {
55
- const startPath = currentFile === "unknown" ? "./" : currentFile;
56
- const computedCwd = specialCwd[optsCwd](startPath);
57
- cwd = computedCwd ? _path.default.dirname(computedCwd) : null;
58
- } else {
59
- cwd = optsCwd;
60
- }
61
- return cwd || process.cwd();
62
- }
63
- function normalizeRoot(optsRoot, cwd) {
64
- if (!optsRoot) {
65
- return [];
66
- }
67
- const rootArray = Array.isArray(optsRoot) ? optsRoot : [
68
- optsRoot
69
- ];
70
- return rootArray.map((dirPath) => _path.default.resolve(cwd, dirPath)).reduce((resolvedDirs, absDirPath) => {
71
- if (_glob.default.hasMagic(absDirPath)) {
72
- const roots = _glob.default.sync(absDirPath).filter((resolvedPath) => _fs.default.lstatSync(resolvedPath).isDirectory());
73
- return [
74
- ...resolvedDirs,
75
- ...roots
76
- ];
77
- }
78
- return [
79
- ...resolvedDirs,
80
- absDirPath
81
- ];
82
- }, []);
83
- }
84
- function getAliasTarget(key, isKeyRegExp) {
85
- const regExpPattern = isKeyRegExp ? key : `^${(0, _utils.escapeRegExp)(key)}(/.*|)$`;
86
- return new RegExp(regExpPattern);
87
- }
88
- function getAliasSubstitute(value, isKeyRegExp) {
89
- if (typeof value === "function") {
90
- return value;
91
- }
92
- if (!isKeyRegExp) {
93
- return ([, match]) => {
94
- if (Array.isArray(value)) {
95
- return value.map((v) => `${v}${match}`);
96
- }
97
- return `${value}${match}`;
98
- };
99
- }
100
- const parts = value.split("\\\\");
101
- return (execResult) => parts.map((part) => part.replace(/\\\d+/g, (number) => execResult[number.slice(1)] || "")).join("\\");
102
- }
103
- function normalizeAlias(optsAlias) {
104
- if (!optsAlias) {
105
- return [];
106
- }
107
- const aliasArray = Array.isArray(optsAlias) ? optsAlias : [
108
- optsAlias
109
- ];
110
- return aliasArray.reduce((aliasPairs, alias) => {
111
- const aliasKeys = Object.keys(alias);
112
- aliasKeys.forEach((key) => {
113
- const isKeyRegExp = isRegExp(key);
114
- aliasPairs.push([
115
- getAliasTarget(key, isKeyRegExp),
116
- getAliasSubstitute(alias[key], isKeyRegExp)
117
- ]);
118
- });
119
- return aliasPairs;
120
- }, []);
121
- }
122
- function normalizeTransformedFunctions(optsTransformFunctions) {
123
- if (!optsTransformFunctions) {
124
- return defaultTransformedFunctions;
125
- }
126
- return [
127
- ...defaultTransformedFunctions,
128
- ...optsTransformFunctions
129
- ];
130
- }
131
- function normalizeLoglevel(optsLoglevel) {
132
- return optsLoglevel || "warn";
133
- }
134
- const _default = (0, _reselect.createSelector)(
135
- // The currentFile should have an extension; otherwise it's considered a special value
136
- (currentFile) => currentFile.includes(".") ? _path.default.dirname(currentFile) : currentFile,
137
- (_, opts) => opts,
138
- (currentFile, opts) => {
139
- const cwd = normalizeCwd(opts.cwd, currentFile);
140
- const root = normalizeRoot(opts.root, cwd);
141
- const alias = normalizeAlias(opts.alias);
142
- const loglevel = normalizeLoglevel(opts.loglevel);
143
- const transformFunctions = normalizeTransformedFunctions(opts.transformFunctions);
144
- const extensions = opts.extensions || defaultExtensions;
145
- const stripExtensions = opts.stripExtensions || extensions;
146
- return {
147
- cwd,
148
- root,
149
- alias,
150
- loglevel,
151
- transformFunctions,
152
- extensions,
153
- stripExtensions,
154
- customResolvePath: opts.resolvePath
155
- };
156
- }
157
- );
@@ -1,92 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "default", {
6
- enumerable: true,
7
- get: function() {
8
- return resolvePath;
9
- }
10
- });
11
- const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
12
- const _path = /* @__PURE__ */ _interop_require_default._(require("path"));
13
- const _log = require("./log");
14
- const _mapToRelative = /* @__PURE__ */ _interop_require_default._(require("./mapToRelative"));
15
- const _normalizeOptions = /* @__PURE__ */ _interop_require_default._(require("./normalizeOptions"));
16
- const _utils = require("./utils");
17
- function getRelativePath(sourcePath, currentFile, absFileInRoot, opts) {
18
- const realSourceFileExtension = _path.default.extname(absFileInRoot);
19
- const sourceFileExtension = _path.default.extname(sourcePath);
20
- let relativePath = (0, _mapToRelative.default)(opts.cwd, currentFile, absFileInRoot);
21
- if (realSourceFileExtension !== sourceFileExtension) {
22
- relativePath = (0, _utils.replaceExtension)(relativePath, opts);
23
- }
24
- return (0, _utils.toLocalPath)((0, _utils.toPosixPath)(relativePath));
25
- }
26
- function findPathInRoots(sourcePath, { extensions, root }) {
27
- let resolvedSourceFile;
28
- root.some((basedir) => {
29
- resolvedSourceFile = (0, _utils.nodeResolvePath)(`./${sourcePath}`, basedir, extensions);
30
- return resolvedSourceFile !== null;
31
- });
32
- return resolvedSourceFile;
33
- }
34
- function resolvePathFromRootConfig(sourcePath, currentFile, opts) {
35
- const absFileInRoot = findPathInRoots(sourcePath, opts);
36
- if (!absFileInRoot) {
37
- return null;
38
- }
39
- return getRelativePath(sourcePath, currentFile, absFileInRoot, opts);
40
- }
41
- function checkIfPackageExists(modulePath, currentFile, extensions, loglevel) {
42
- const resolvedPath = (0, _utils.nodeResolvePath)(modulePath, currentFile, extensions);
43
- if (resolvedPath === null && loglevel !== "silent") {
44
- (0, _log.warn)(`Could not resolve "${modulePath}" in file ${currentFile}.`);
45
- }
46
- }
47
- function resolvePathFromAliasConfig(sourcePath, currentFile, opts) {
48
- let aliasedSourceFile;
49
- opts.alias.find(([regExp, substitute]) => {
50
- const execResult = regExp.exec(sourcePath);
51
- if (execResult === null) {
52
- return false;
53
- }
54
- aliasedSourceFile = substitute(execResult);
55
- return true;
56
- });
57
- if (!aliasedSourceFile) {
58
- return null;
59
- }
60
- if (Array.isArray(aliasedSourceFile)) {
61
- return aliasedSourceFile.map((asf) => {
62
- if ((0, _utils.isRelativePath)(asf)) {
63
- return (0, _utils.toLocalPath)((0, _utils.toPosixPath)((0, _mapToRelative.default)(opts.cwd, currentFile, asf)));
64
- }
65
- return asf;
66
- }).find((src) => (0, _utils.nodeResolvePath)(src, _path.default.dirname(currentFile), opts.extensions));
67
- }
68
- if ((0, _utils.isRelativePath)(aliasedSourceFile)) {
69
- return (0, _utils.toLocalPath)((0, _utils.toPosixPath)((0, _mapToRelative.default)(opts.cwd, currentFile, aliasedSourceFile)));
70
- }
71
- if (process.env.NODE_ENV !== "production") {
72
- checkIfPackageExists(aliasedSourceFile, currentFile, opts.extensions, opts.loglevel);
73
- }
74
- return aliasedSourceFile;
75
- }
76
- const resolvers = [
77
- resolvePathFromAliasConfig,
78
- resolvePathFromRootConfig
79
- ];
80
- function resolvePath(sourcePath, currentFile, opts) {
81
- if ((0, _utils.isRelativePath)(sourcePath)) {
82
- return sourcePath;
83
- }
84
- const normalizedOpts = (0, _normalizeOptions.default)(currentFile, opts);
85
- const absoluteCurrentFile = _path.default.resolve(currentFile);
86
- let resolvedPath = null;
87
- resolvers.some((resolver) => {
88
- resolvedPath = resolver(sourcePath, absoluteCurrentFile, normalizedOpts);
89
- return resolvedPath !== null;
90
- });
91
- return resolvedPath;
92
- }
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "default", {
6
- enumerable: true,
7
- get: function() {
8
- return transformCall;
9
- }
10
- });
11
- const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
12
- const _utils = require("../utils");
13
- const _mapPath = /* @__PURE__ */ _interop_require_default._(require("../mapPath"));
14
- function transformCall(nodePath, state) {
15
- if (state.moduleResolverVisited.has(nodePath)) {
16
- return;
17
- }
18
- const calleePath = nodePath.get("callee");
19
- const isNormalCall = state.normalizedOpts.transformFunctions.some((pattern) => (0, _utils.matchesPattern)(state.types, calleePath, pattern));
20
- if (isNormalCall || (0, _utils.isImportCall)(state.types, nodePath)) {
21
- state.moduleResolverVisited.add(nodePath);
22
- (0, _mapPath.default)(nodePath.get("arguments.0"), state);
23
- }
24
- }
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "default", {
6
- enumerable: true,
7
- get: function() {
8
- return transformImport;
9
- }
10
- });
11
- const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
12
- const _mapPath = /* @__PURE__ */ _interop_require_default._(require("../mapPath"));
13
- function transformImport(nodePath, state) {
14
- if (state.moduleResolverVisited.has(nodePath)) {
15
- return;
16
- }
17
- state.moduleResolverVisited.add(nodePath);
18
- (0, _mapPath.default)(nodePath.get("source"), state);
19
- }