next-translate-plugin 3.0.0-canary.8 → 3.0.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.
package/lib/cjs/utils.js CHANGED
@@ -215,7 +215,22 @@ function getDefaultExport(filePkg, resolveExport) {
215
215
  return getNamedExport(filePkg, 'default', resolveExport);
216
216
  }
217
217
  function hasExportName(filePkg, name) {
218
- return Boolean(getNamedExport(filePkg, name, false));
218
+ if (Boolean(getNamedExport(filePkg, name, false)))
219
+ return true;
220
+ var isDataFetchingMethod = [
221
+ 'getStaticProps',
222
+ 'getStaticPaths',
223
+ 'getServerSideProps',
224
+ 'getInitialProps',
225
+ ].includes(name);
226
+ if (!isDataFetchingMethod)
227
+ return false;
228
+ return filePkg.sourceFile.statements.some(function (node) {
229
+ return (typescript_1.default.isExportDeclaration(node) &&
230
+ !node.isTypeOnly &&
231
+ !node.exportClause &&
232
+ node.moduleSpecifier !== undefined);
233
+ });
219
234
  }
220
235
  function getStaticName(filePkg, target, name) {
221
236
  var symbol = getSymbol(filePkg, target);
package/lib/esm/utils.js CHANGED
@@ -182,7 +182,22 @@ export function getDefaultExport(filePkg, resolveExport) {
182
182
  return getNamedExport(filePkg, 'default', resolveExport);
183
183
  }
184
184
  export function hasExportName(filePkg, name) {
185
- return Boolean(getNamedExport(filePkg, name, false));
185
+ if (Boolean(getNamedExport(filePkg, name, false)))
186
+ return true;
187
+ var isDataFetchingMethod = [
188
+ 'getStaticProps',
189
+ 'getStaticPaths',
190
+ 'getServerSideProps',
191
+ 'getInitialProps',
192
+ ].includes(name);
193
+ if (!isDataFetchingMethod)
194
+ return false;
195
+ return filePkg.sourceFile.statements.some(function (node) {
196
+ return (ts.isExportDeclaration(node) &&
197
+ !node.isTypeOnly &&
198
+ !node.exportClause &&
199
+ node.moduleSpecifier !== undefined);
200
+ });
186
201
  }
187
202
  export function getStaticName(filePkg, target, name) {
188
203
  var symbol = getSymbol(filePkg, target);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-translate-plugin",
3
- "version": "3.0.0-canary.8",
3
+ "version": "3.0.0",
4
4
  "description": "Tiny and powerful i18n plugin to translate your Next.js pages.",
5
5
  "license": "MIT",
6
6
  "keywords": [