next-translate 1.3.2 → 1.3.3

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.
@@ -5,7 +5,7 @@ function templateWithHoc(code, _a) {
5
5
  var _b = _a === void 0 ? {} : _a, _c = _b.skipInitialProps, skipInitialProps = _c === void 0 ? false : _c, _d = _b.typescript, typescript = _d === void 0 ? false : _d, _e = _b.pageName, pageName = _e === void 0 ? '__Page_Next_Translate__' : _e, _f = _b.hasLoadLocaleFrom, hasLoadLocaleFrom = _f === void 0 ? false : _f;
6
6
  var tokenToReplace = "__CODE_TOKEN_".concat(Date.now().toString(16), "__");
7
7
  var codeWithoutComments = code.replace(utils_1.clearCommentsRgx, '');
8
- var modifiedCode = codeWithoutComments.replace(/export +default/g, "const ".concat(pageName, " ="));
8
+ var modifiedCode = code.replace(/export +default/g, "const ".concat(pageName, " ="));
9
9
  var _g = codeWithoutComments.match(/export +default +(function|class) +([A-Z]\w*)/) || [], componentName = _g[2];
10
10
  if (componentName) {
11
11
  modifiedCode = modifiedCode.replace(new RegExp("\\W".concat(componentName, "\\.getInitialProps"), 'g'), "".concat(pageName, ".getInitialProps"));
@@ -4,7 +4,7 @@ var utils_1 = require("./utils");
4
4
  function templateWithLoader(rawCode, _a) {
5
5
  var _b = _a === void 0 ? {} : _a, _c = _b.page, page = _c === void 0 ? '' : _c, _d = _b.typescript, typescript = _d === void 0 ? false : _d, _e = _b.loader, loader = _e === void 0 ? 'getStaticProps' : _e, _f = _b.hasLoader, hasLoader = _f === void 0 ? false : _f, _g = _b.hasLoadLocaleFrom, hasLoadLocaleFrom = _g === void 0 ? false : _g, _h = _b.revalidate, revalidate = _h === void 0 ? 0 : _h;
6
6
  var tokenToReplace = "__CODE_TOKEN_".concat(Date.now().toString(16), "__");
7
- var modifiedCode = rawCode.replace(utils_1.clearCommentsRgx, '');
7
+ var modifiedCode = rawCode;
8
8
  if (hasLoader) {
9
9
  modifiedCode = modifiedCode
10
10
  .replace(new RegExp("(const|var|let|async +function|function|import|import {.* as) +".concat(loader, "\\W")), function (v) {
@@ -3,7 +3,7 @@ export default function templateWithHoc(code, _a) {
3
3
  var _b = _a === void 0 ? {} : _a, _c = _b.skipInitialProps, skipInitialProps = _c === void 0 ? false : _c, _d = _b.typescript, typescript = _d === void 0 ? false : _d, _e = _b.pageName, pageName = _e === void 0 ? '__Page_Next_Translate__' : _e, _f = _b.hasLoadLocaleFrom, hasLoadLocaleFrom = _f === void 0 ? false : _f;
4
4
  var tokenToReplace = "__CODE_TOKEN_".concat(Date.now().toString(16), "__");
5
5
  var codeWithoutComments = code.replace(clearCommentsRgx, '');
6
- var modifiedCode = codeWithoutComments.replace(/export +default/g, "const ".concat(pageName, " ="));
6
+ var modifiedCode = code.replace(/export +default/g, "const ".concat(pageName, " ="));
7
7
  var _g = codeWithoutComments.match(/export +default +(function|class) +([A-Z]\w*)/) || [], componentName = _g[2];
8
8
  if (componentName) {
9
9
  modifiedCode = modifiedCode.replace(new RegExp("\\W".concat(componentName, "\\.getInitialProps"), 'g'), "".concat(pageName, ".getInitialProps"));
@@ -1,8 +1,8 @@
1
- import { clearCommentsRgx, overwriteLoadLocales } from './utils';
1
+ import { overwriteLoadLocales } from './utils';
2
2
  export default function templateWithLoader(rawCode, _a) {
3
3
  var _b = _a === void 0 ? {} : _a, _c = _b.page, page = _c === void 0 ? '' : _c, _d = _b.typescript, typescript = _d === void 0 ? false : _d, _e = _b.loader, loader = _e === void 0 ? 'getStaticProps' : _e, _f = _b.hasLoader, hasLoader = _f === void 0 ? false : _f, _g = _b.hasLoadLocaleFrom, hasLoadLocaleFrom = _g === void 0 ? false : _g, _h = _b.revalidate, revalidate = _h === void 0 ? 0 : _h;
4
4
  var tokenToReplace = "__CODE_TOKEN_".concat(Date.now().toString(16), "__");
5
- var modifiedCode = rawCode.replace(clearCommentsRgx, '');
5
+ var modifiedCode = rawCode;
6
6
  if (hasLoader) {
7
7
  modifiedCode = modifiedCode
8
8
  .replace(new RegExp("(const|var|let|async +function|function|import|import {.* as) +".concat(loader, "\\W")), function (v) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-translate",
3
- "version": "1.3.2",
3
+ "version": "1.3.3",
4
4
  "description": "Tiny and powerful i18n tools (Next plugin + API) to translate your Next.js pages.",
5
5
  "license": "MIT",
6
6
  "keywords": [