@sasjs/cli 6.2.2 → 6.2.4

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.
@@ -435,13 +435,13 @@ function getContentFor(rootDirectory, folderPath, serverType) {
435
435
  _a = utils_1.removeHeader;
436
436
  return [4 /*yield*/, (0, utils_1.readFile)(filePath)];
437
437
  case 1:
438
- fileContent = _a.apply(void 0, [_b.sent()]);
438
+ fileContent = _a.apply(void 0, [_b.sent(), filePath]);
439
439
  transformedContent = getServiceText(file, fileContent, serverType);
440
440
  content += "\n".concat(transformedContent, "\n");
441
441
  contentJSON.members.push({
442
442
  name: file.replace(/.sas$/, ''),
443
443
  type: types_1.MemberType.service,
444
- code: (0, utils_1.removeHeader)(fileContent)
444
+ code: (0, utils_1.removeHeader)(fileContent, filePath)
445
445
  });
446
446
  return [3 /*break*/, 4];
447
447
  case 2: return [4 /*yield*/, (0, utils_1.base64EncodeFile)(filePath)];
@@ -59,7 +59,7 @@ function loadDependencies(target, filePath, macroFolders, programFolders, type,
59
59
  return [4 /*yield*/, (0, utils_1.readFile)(filePath)];
60
60
  case 1:
61
61
  // If file is of a generic type SASJsFileType.file, then just read the file content without header
62
- fileContent = _a.apply(void 0, [_d.sent()]);
62
+ fileContent = _a.apply(void 0, [_d.sent(), filePath]);
63
63
  return [3 /*break*/, 5];
64
64
  case 2:
65
65
  leaf = compileTree.getLeaf(filePath);
@@ -204,6 +204,26 @@ describe('loadDependencies', function () {
204
204
  }
205
205
  });
206
206
  }); });
207
+ test('it should name the file when a file header is truncated', function () { return __awaiter(void 0, void 0, void 0, function () {
208
+ var filePath, error;
209
+ return __generator(this, function (_a) {
210
+ switch (_a.label) {
211
+ case 0:
212
+ filePath = path_1.default.join(__dirname, './truncated-header.sas');
213
+ return [4 /*yield*/, (0, loadDependencies_1.loadDependencies)(target, filePath, [], [], utils_1.SASJsFileType.file, compileTree).catch(function (e) { return e; })
214
+ // The wording belongs to @sasjs/utils; this pins the file name the CLI adds
215
+ // and the shape of the diagnostic, not the library's phrasing.
216
+ ];
217
+ case 1:
218
+ error = _a.sent();
219
+ // The wording belongs to @sasjs/utils; this pins the file name the CLI adds
220
+ // and the shape of the diagnostic, not the library's phrasing.
221
+ expect(error instanceof Error ? error.message : String(error)).toMatch(new RegExp("^".concat(filePath.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), ": ")));
222
+ expect(error instanceof Error ? error.message : String(error)).toMatch(/\bline \d+/);
223
+ return [2 /*return*/];
224
+ }
225
+ });
226
+ }); });
207
227
  test("it should load dependencies for a job ".concat(utils_1.DependencyHeader.Macro), function () { return __awaiter(void 0, void 0, void 0, function () {
208
228
  var dependencies;
209
229
  return __generator(this, function (_a) {
package/package.json CHANGED
@@ -71,8 +71,8 @@
71
71
  },
72
72
  "dependencies": {
73
73
  "@sasjs/adapter": "^5.1.1",
74
- "@sasjs/core": "^6.0.0",
75
- "@sasjs/utils": "^4.1.0",
74
+ "@sasjs/core": "^6.1.1",
75
+ "@sasjs/utils": "^4.1.1",
76
76
  "axios": "1.20.0",
77
77
  "chalk": "4.1.2",
78
78
  "dotenv": "18.0.8",
@@ -94,7 +94,7 @@
94
94
  "@babel/preset-env": "7.29.7",
95
95
  "@babel/preset-typescript": "7.29.7",
96
96
  "@nogoo9/gitleaks": "8.30.1-post.2",
97
- "@sasjs/lint": "^4.3.1",
97
+ "@sasjs/lint": "^4.4.0",
98
98
  "@types/debug": "4.1.13",
99
99
  "@types/find": "0.2.4",
100
100
  "@types/jest": "30.0.0",
@@ -124,7 +124,7 @@
124
124
  "nanoid": "3.3.18"
125
125
  },
126
126
  "peerDependencies": {
127
- "@sasjs/lint": "^4.3.1"
127
+ "@sasjs/lint": "^4.4.0"
128
128
  },
129
- "version": "6.2.2"
129
+ "version": "6.2.4"
130
130
  }