@navikt/aksel 3.3.1 → 3.4.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.
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ const lineterminator_1 = require("../../../utils/lineterminator");
6
7
  const rename_props_1 = __importDefault(require("../../../utils/rename-props"));
7
8
  /**
8
9
  * @param {import('jscodeshift').FileInfo} file
@@ -60,6 +61,6 @@ function transformer(file, api, options) {
60
61
  }
61
62
  });
62
63
  }
63
- return root.toSource(options.printOptions);
64
+ return root.toSource((0, lineterminator_1.getLineTerminator)(file.source));
64
65
  }
65
66
  exports.default = transformer;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const lineterminator_1 = require("../../../utils/lineterminator");
3
4
  /**
4
5
  * @param {import('jscodeshift').FileInfo} file
5
6
  * @param {import('jscodeshift').API} api
@@ -61,6 +62,6 @@ function transformer(file, api, options) {
61
62
  addExplicitStandardProp(parent.value);
62
63
  });
63
64
  }
64
- return root.toSource(options.printOptions);
65
+ return root.toSource((0, lineterminator_1.getLineTerminator)(file.source));
65
66
  }
66
67
  exports.default = transformer;
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ const lineterminator_1 = require("../../../utils/lineterminator");
6
7
  const rename_props_1 = __importDefault(require("../../../utils/rename-props"));
7
8
  /**
8
9
  * @param {import('jscodeshift').FileInfo} file
@@ -73,6 +74,6 @@ function transformer(file, api, options) {
73
74
  iconPositionProp = null;
74
75
  });
75
76
  }
76
- return root.toSource(options.printOptions);
77
+ return root.toSource((0, lineterminator_1.getLineTerminator)(file.source));
77
78
  }
78
79
  exports.default = transformer;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const imports_1 = require("../../../utils/imports");
4
4
  const translate_token_1 = require("../../../utils/translate-token");
5
5
  const tokens_map_mjs_1 = require("../../../tokens-map.mjs");
6
+ const lineterminator_1 = require("../../../utils/lineterminator");
6
7
  /**
7
8
  * @param {import('jscodeshift').FileInfo} file
8
9
  * @param {import('jscodeshift').API} api
@@ -25,12 +26,12 @@ function transformer(file, api) {
25
26
  if (name === foundName) {
26
27
  const localName = (0, imports_1.getImportSpecifierName)(j, root, name, "@navikt/ds-tokens/dist/tokens") || name;
27
28
  (0, imports_1.renameImportSpecifier)(j, root, name, out, "@navikt/ds-tokens/dist/tokens");
28
- let code = root.toSource();
29
+ let code = root.toSource((0, lineterminator_1.getLineTerminator)(file.source));
29
30
  const rgx = new RegExp("(" + localName + ")", "gm");
30
31
  code = code.replace(rgx, out);
31
32
  root = j(code);
32
33
  }
33
34
  });
34
- return root.toSource();
35
+ return root.toSource((0, lineterminator_1.getLineTerminator)(file.source));
35
36
  }
36
37
  exports.default = transformer;
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const chalk_1 = __importDefault(require("chalk"));
7
7
  const moveAndRenameImport_1 = __importDefault(require("../../../utils/moveAndRenameImport"));
8
8
  const removeProps_1 = __importDefault(require("../../../utils/removeProps"));
9
+ const lineterminator_1 = require("../../../utils/lineterminator");
9
10
  /**
10
11
  * @param {import('jscodeshift').FileInfo} file
11
12
  * @param {import('jscodeshift').API} api
@@ -27,7 +28,7 @@ function transformer(file, api, options, ...rest) {
27
28
  toName,
28
29
  });
29
30
  if (localName === null) {
30
- return root.toSource(options.printOptions);
31
+ return root.toSource((0, lineterminator_1.getLineTerminator)(file.source));
31
32
  }
32
33
  /* Finds and replaces import from CopyToClipboard -> CopyButton */
33
34
  if (root.findJSXElements(localName)) {
@@ -67,6 +68,6 @@ function transformer(file, api, options, ...rest) {
67
68
  }
68
69
  });
69
70
  }
70
- return root.toSource(options.printOptions);
71
+ return root.toSource((0, lineterminator_1.getLineTerminator)(file.source));
71
72
  }
72
73
  exports.default = transformer;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getLineTerminator = void 0;
4
+ const getLineTerminator = (source) => ({
5
+ lineTerminator: source.includes("\r\n") ? "\r\n" : "\n",
6
+ });
7
+ exports.getLineTerminator = getLineTerminator;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@navikt/aksel",
3
- "version": "3.3.1",
3
+ "version": "3.4.0",
4
4
  "description": "Aksel command line interface. Handles css-imports, codemods and more",
5
5
  "author": "Aksel | NAV designsystem team",
6
6
  "license": "MIT",
@@ -29,7 +29,7 @@
29
29
  },
30
30
  "homepage": "https://aksel.nav.no/grunnleggende/kode/kommandolinje",
31
31
  "dependencies": {
32
- "@navikt/ds-css": "3.3.1",
32
+ "@navikt/ds-css": "3.4.0",
33
33
  "axios": "1.3.6",
34
34
  "chalk": "4.1.0",
35
35
  "clipboardy": "^2.3.0",