@sasjs/cli 6.32.0 → 6.32.1

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.
@@ -37,6 +37,7 @@
37
37
  */
38
38
  importScripts('host/runtime-core.js')
39
39
  importScripts('host/api-browser.js')
40
+ importScripts('host/lint-browser.js')
40
41
 
41
42
  const R = self.SASjsMockRuntime
42
43
 
@@ -967,19 +968,18 @@ const LINT_CONFIG_FILE = '.sasjslint'
967
968
  * The linter, bundled at build time from the installed @sasjs/api/code and
968
969
  * @sasjs/lint (see mockSite.ts).
969
970
  *
970
- * Imported on the first code route rather than by the worker at boot: it is
971
- * around 40KB of the worker's payload for two routes (`code/lint` and
972
- * `code/format`), and the install has to finish before the page may make its
973
- * first request - so every visit pays it, including the ones that never open the
974
- * editor. The build stamps the version into the URL below, so the copy fetched
975
- * here is cache-busted with the rest of the host.
971
+ * Imported with the rest of the host, not on the first code route: a service
972
+ * worker may only `importScripts` while its own script is being evaluated, so a
973
+ * call made from a request handler fails with "The script at ... failed to load"
974
+ * - the linter would be missing exactly where it is needed. What stays lazy is the
975
+ * service built from it: `createCodeService` is cheap, and only a code route
976
+ * calls it.
976
977
  */
977
978
  let codeService
978
979
  let linter
979
980
 
980
981
  const code = () => {
981
982
  if (codeService) return codeService
982
- importScripts('host/lint-browser.js')
983
983
  linter = self.SASjsCode
984
984
  codeService = linter.createCodeService({ lintConfig })
985
985
  return codeService
@@ -1442,25 +1442,27 @@ describe('service worker host', function () {
1442
1442
  });
1443
1443
  }); });
1444
1444
  /**
1445
- * The linter is not part of the install.
1445
+ * The linter is imported with the host, because it has to be.
1446
1446
  *
1447
- * The page cannot make its first request until the worker has installed, so
1448
- * anything the worker imports at boot is on the critical path of every
1449
- * visit. The linter answers two routes; it is fetched when one of them is
1450
- * called.
1447
+ * A service worker may only `importScripts` while its own script is being
1448
+ * evaluated: a call made from a request handler fails with "The script at ...
1449
+ * failed to load", which is what a lazy import gave a real browser - the two
1450
+ * code routes answered 500. So the import is at boot, and the assertion is
1451
+ * that a code route answers *without* importing anything at request time.
1451
1452
  */
1452
- it('fetches the linter on the first code route, not at boot', function () { return __awaiter(void 0, void 0, void 0, function () {
1453
- var worker, response;
1453
+ it('imports the linter at boot and answers a code route without importing', function () { return __awaiter(void 0, void 0, void 0, function () {
1454
+ var worker, before, response;
1454
1455
  return __generator(this, function (_a) {
1455
1456
  switch (_a.label) {
1456
1457
  case 0:
1457
1458
  worker = seeded();
1458
- expect(worker.imported.some(function (path) { return path.includes('lint-browser'); })).toBe(false);
1459
+ expect(worker.imported.some(function (path) { return path.includes('lint-browser'); })).toBe(true);
1460
+ before = worker.imported.length;
1459
1461
  return [4 /*yield*/, worker.dispatch('/SASjsApi/code/lint', runRequest({ code: 'data a;\nrun;\n' }))];
1460
1462
  case 1:
1461
1463
  response = _a.sent();
1462
1464
  expect(response.status).toBe(200);
1463
- expect(worker.imported.some(function (path) { return path.includes('lint-browser'); })).toBe(true);
1465
+ expect(worker.imported.length).toBe(before);
1464
1466
  return [2 /*return*/];
1465
1467
  }
1466
1468
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sasjs/cli",
3
- "version": "6.32.0",
3
+ "version": "6.32.1",
4
4
  "description": "Command line interface for SASjs",
5
5
  "engines": {
6
6
  "node": "^22.14.0 || >=24.10.0"