sfmc-language-lsp 4.4.1 → 4.5.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.
Files changed (54) hide show
  1. package/README.md +39 -0
  2. package/dist/cjs/package-version.cjs +1 -1
  3. package/dist/cjs/typescript/index.cjs +16 -0
  4. package/dist/cjs/typescript/index.d.ts +11 -0
  5. package/dist/cjs/typescript/index.d.ts.map +1 -0
  6. package/dist/cjs/typescript/index.js.map +1 -0
  7. package/dist/cjs/typescript/orchestration.cjs +108 -0
  8. package/dist/cjs/typescript/orchestration.d.ts +59 -0
  9. package/dist/cjs/typescript/orchestration.d.ts.map +1 -0
  10. package/dist/cjs/typescript/orchestration.js.map +1 -0
  11. package/dist/cjs/typescript/service.cjs +810 -0
  12. package/dist/cjs/typescript/service.d.ts +52 -0
  13. package/dist/cjs/typescript/service.d.ts.map +1 -0
  14. package/dist/cjs/typescript/service.js.map +1 -0
  15. package/dist/cjs/typescript/source-analysis.cjs +582 -0
  16. package/dist/cjs/typescript/source-analysis.d.ts +110 -0
  17. package/dist/cjs/typescript/source-analysis.d.ts.map +1 -0
  18. package/dist/cjs/typescript/source-analysis.js.map +1 -0
  19. package/dist/cjs/utils/text.cjs +18 -3
  20. package/dist/cjs/utils/text.d.ts +6 -0
  21. package/dist/cjs/utils/text.d.ts.map +1 -1
  22. package/dist/cjs/utils/text.js.map +1 -1
  23. package/dist/esm/package-version.js +1 -1
  24. package/dist/esm/typescript/index.d.ts +11 -0
  25. package/dist/esm/typescript/index.d.ts.map +1 -0
  26. package/dist/esm/typescript/index.js +9 -0
  27. package/dist/esm/typescript/index.js.map +1 -0
  28. package/dist/esm/typescript/orchestration.d.ts +59 -0
  29. package/dist/esm/typescript/orchestration.d.ts.map +1 -0
  30. package/dist/esm/typescript/orchestration.js +103 -0
  31. package/dist/esm/typescript/orchestration.js.map +1 -0
  32. package/dist/esm/typescript/service.d.ts +52 -0
  33. package/dist/esm/typescript/service.d.ts.map +1 -0
  34. package/dist/esm/typescript/service.js +774 -0
  35. package/dist/esm/typescript/service.js.map +1 -0
  36. package/dist/esm/typescript/source-analysis.d.ts +110 -0
  37. package/dist/esm/typescript/source-analysis.d.ts.map +1 -0
  38. package/dist/esm/typescript/source-analysis.js +572 -0
  39. package/dist/esm/typescript/source-analysis.js.map +1 -0
  40. package/dist/esm/utils/text.d.ts +6 -0
  41. package/dist/esm/utils/text.d.ts.map +1 -1
  42. package/dist/esm/utils/text.js +18 -3
  43. package/dist/esm/utils/text.js.map +1 -1
  44. package/dist/types/typescript/index.d.ts +11 -0
  45. package/dist/types/typescript/index.d.ts.map +1 -0
  46. package/dist/types/typescript/orchestration.d.ts +59 -0
  47. package/dist/types/typescript/orchestration.d.ts.map +1 -0
  48. package/dist/types/typescript/service.d.ts +52 -0
  49. package/dist/types/typescript/service.d.ts.map +1 -0
  50. package/dist/types/typescript/source-analysis.d.ts +110 -0
  51. package/dist/types/typescript/source-analysis.d.ts.map +1 -0
  52. package/dist/types/utils/text.d.ts +6 -0
  53. package/dist/types/utils/text.d.ts.map +1 -1
  54. package/package.json +14 -1
package/README.md CHANGED
@@ -59,6 +59,45 @@ Use the unchanged `validateSsjs(text, settings?)` entry point for raw SSJS. The
59
59
 
60
60
  **Available since 4.3.0:** the script-region helpers and mixed-document SSJS validator are public APIs in `sfmc-language-lsp@4.3.0` and later. Consumers using these APIs must require at least version `4.3.0` and refresh their lockfiles from the npm registry.
61
61
 
62
+ ## TypeScript-based SSJS intelligence (`sfmc-language-lsp/typescript`)
63
+
64
+ The subpath `sfmc-language-lsp/typescript` runs a TypeScript language service over SSJS, typed by the SSJS declarations that `ssjs-data` ships. It answers what the catalogue of the main entry cannot: the members of a value (`DataExtension.Init("x").Rows.`), type errors, hover and signature help for your own functions and polyfills, go to definition and find references. It is SSJS only and browser-compatible: it reads no files, and you hand it the declarations as text.
65
+
66
+ `typescript` is an **optional peer dependency** (`^6`). Only this subpath needs it; the main entry never loads it, so consumers of the main entry alone do not have to install it.
67
+
68
+ ```js
69
+ import { readFileSync } from 'node:fs';
70
+ import { createRequire } from 'node:module';
71
+ import { sfmcLanguageService } from 'sfmc-language-lsp';
72
+ import { createSsjsTypeScriptService, memberCompletions } from 'sfmc-language-lsp/typescript';
73
+
74
+ // In a bundle, inline this text at build time instead of reading it.
75
+ const globalsDts = readFileSync(
76
+ createRequire(import.meta.url).resolve('ssjs-data/sfmc-globals.d.ts'),
77
+ 'utf8',
78
+ );
79
+ const service = createSsjsTypeScriptService({ globalsDts });
80
+
81
+ const uri = 'file:///example.ssjs';
82
+ const text = 'Platform.Function.';
83
+ const position = { line: 0, character: text.length };
84
+ service.updateDocument(uri, text);
85
+
86
+ const { items, isMemberCompletion } = service.getCompletionInfo(uri, position);
87
+ const members = memberCompletions({
88
+ typescriptItems: items,
89
+ isMemberAccess: isMemberCompletion,
90
+ catalogueItems: sfmcLanguageService.getCompletions({ text, languageId: 'ssjs', uri }, position),
91
+ receiver: 'Platform.Function',
92
+ });
93
+ // members: Lookup, LookupRows, … each with the catalogue's documentation and an insert
94
+ // text for the member alone; null where TypeScript does not know the receiver's type.
95
+ ```
96
+
97
+ - `createSsjsTypeScriptService({ globalsDts, diagnosticUrl? })` returns an independent instance with `updateDocument`, `removeDocument`, `getCompletions`, `getCompletionInfo`, `getDiagnostics`, `getHover`, `getDefinition`, `getReferences` and `getSignatureHelp`. Results are LSP types. `diagnosticUrl(code)` may supply a documentation link per TypeScript diagnostic code.
98
+ - For a mixed HTML document, pass `ssjsProjection(text)` to `updateDocument`: it keeps only the server-side script bodies, at their original offsets. `isInSsjsRegion(text, offset)` tells whether a position belongs to SSJS.
99
+ - `memberCompletions(...)` is the shared rule for completions after a dot: TypeScript decides which members exist, and the catalogue describes those it knows. Pass `hasNew: true` when `new` precedes the receiver (`new Script.Util.`), so that a constructor is inserted as a call.
100
+
62
101
  ## Core-version-aware SSJS diagnostics
63
102
 
64
103
  Some Core library members only exist up to a maximum `Platform.Load("Core", <version>)` and are `undefined` beyond it. The SSJS validator reads the `maxCoreVersion` metadata from `ssjs-data`, compares it against the Core version the document actually loads, and escalates the diagnostic accordingly:
@@ -2,5 +2,5 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LSP_PACKAGE_VERSION = void 0;
4
4
  // Generated by scripts/generate-package-version.mjs; do not edit.
5
- exports.LSP_PACKAGE_VERSION = '4.4.1';
5
+ exports.LSP_PACKAGE_VERSION = '4.5.1';
6
6
  //# sourceMappingURL=package-version.js.map
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.memberCompletions = exports.isInSsjsRegion = exports.ssjsProjection = exports.createSsjsTypeScriptService = void 0;
4
+ /**
5
+ * `sfmc-language-lsp/typescript` — TypeScript-based SSJS intelligence.
6
+ *
7
+ * A separate entry of the package: it needs the optional peer dependency `typescript`, which the
8
+ * main entry never loads.
9
+ */
10
+ var service_js_1 = require("./service.cjs");
11
+ Object.defineProperty(exports, "createSsjsTypeScriptService", { enumerable: true, get: function () { return service_js_1.createSsjsTypeScriptService; } });
12
+ var orchestration_js_1 = require("./orchestration.cjs");
13
+ Object.defineProperty(exports, "ssjsProjection", { enumerable: true, get: function () { return orchestration_js_1.ssjsProjection; } });
14
+ Object.defineProperty(exports, "isInSsjsRegion", { enumerable: true, get: function () { return orchestration_js_1.isInSsjsRegion; } });
15
+ Object.defineProperty(exports, "memberCompletions", { enumerable: true, get: function () { return orchestration_js_1.memberCompletions; } });
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,11 @@
1
+ /**
2
+ * `sfmc-language-lsp/typescript` — TypeScript-based SSJS intelligence.
3
+ *
4
+ * A separate entry of the package: it needs the optional peer dependency `typescript`, which the
5
+ * main entry never loads.
6
+ */
7
+ export { createSsjsTypeScriptService } from './service.js';
8
+ export type { SsjsCompletionInfo, SsjsTypeScriptService, SsjsTypeScriptServiceOptions, } from './service.js';
9
+ export { ssjsProjection, isInSsjsRegion, memberCompletions } from './orchestration.js';
10
+ export type { MemberCompletionsInput } from './orchestration.js';
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/typescript/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,2BAA2B,EAAE,MAAM,cAAc,CAAC;AAC3D,YAAY,EACR,kBAAkB,EAClB,qBAAqB,EACrB,4BAA4B,GAC/B,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvF,YAAY,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/typescript/index.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,2CAA2D;AAAlD,yHAAA,2BAA2B,OAAA;AAMpC,uDAAuF;AAA9E,kHAAA,cAAc,OAAA;AAAE,kHAAA,cAAc,OAAA;AAAE,qHAAA,iBAAiB,OAAA"}
@@ -0,0 +1,108 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ssjsProjection = ssjsProjection;
4
+ exports.isInSsjsRegion = isInSsjsRegion;
5
+ exports.memberCompletions = memberCompletions;
6
+ /**
7
+ * Shared rules for combining the TypeScript-based SSJS service with the SFMC catalogue in mixed
8
+ * HTML documents. These helpers are pure: catalogue results are handed in by the caller, so this
9
+ * module does not load the catalogue or the language data.
10
+ */
11
+ const vscode_languageserver_types_1 = require("vscode-languageserver-types");
12
+ const regions_js_1 = require("../utils/regions.cjs");
13
+ /**
14
+ * Keep only the SSJS of a mixed document. Everything else becomes spaces (line breaks stay), so
15
+ * every offset and position of the result is one of the document.
16
+ * @param text - full mixed document
17
+ * @returns text of the same length holding only the bodies of server-side scripts
18
+ */
19
+ function ssjsProjection(text) {
20
+ return (0, regions_js_1.extractScriptBodies)(text, ['ssjs']).text;
21
+ }
22
+ /**
23
+ * Tell whether an offset lies in the body of a server-side script. Both ends count, so a cursor
24
+ * right before the closing tag is still inside.
25
+ * @param text - full mixed document
26
+ * @param offset - zero-based UTF-16 offset
27
+ * @returns true if the offset is inside SSJS
28
+ */
29
+ function isInSsjsRegion(text, offset) {
30
+ return (0, regions_js_1.getScriptRegions)(text).some((region) => region.kind === 'ssjs' && offset >= region.bodyStart && offset <= region.bodyEnd);
31
+ }
32
+ /**
33
+ * `data.type` of the catalogue's entries whose receiver stands for an instance (`req.send`), not
34
+ * for a global. A variable that happens to have that name must not be described by them.
35
+ */
36
+ const INSTANCE_PLACEHOLDER_TYPES = new Set(['ssjs-script-util-request']);
37
+ const COMMENTS = /\/\*[\s\S]*?\*\/|\/\/[^\n]*/g;
38
+ const LEADING_NEW = /^\s*new\s+/;
39
+ /**
40
+ * Cut the catalogue's insert text down to the member, as the receiver is in the document already.
41
+ * @param insertText - what the catalogue inserts, like `Platform.Function.Lookup(${1:name})`
42
+ * @param qualified - receiver and member, like `Platform.Function.Lookup`
43
+ * @param member - the member's own name
44
+ * @returns insert text that starts with the member, or undefined if the catalogue's cannot be cut
45
+ */
46
+ function memberInsertText(insertText, qualified, member) {
47
+ const index = insertText.indexOf(qualified);
48
+ if (index !== -1)
49
+ return insertText.slice(index + qualified.length - member.length);
50
+ return insertText.startsWith(member) ? insertText : undefined;
51
+ }
52
+ /**
53
+ * The completions after a member access in SSJS. TypeScript decides which members exist; the
54
+ * catalogue describes those it knows.
55
+ *
56
+ * TypeScript's items are taken without its "unknown type" filler: for a receiver of type `any` it
57
+ * lists the names used in the file, as items of kind `Text`. Each remaining member is looked up in
58
+ * the catalogue as `<receiver>.<member>`. A match contributes `detail`, `documentation`,
59
+ * `insertText` (cut down to the member), `insertTextFormat`, `tags` and `data`; the member keeps
60
+ * its short label, which is what is shown and filtered by. The insert text of a constructor is
61
+ * left out where the document has no `new` in front of the receiver.
62
+ * @param input - TypeScript's items, the catalogue's items and the receiver
63
+ * @returns the members, or null if TypeScript knows none and the caller should use its own path
64
+ */
65
+ function memberCompletions(input) {
66
+ if (!input.isMemberAccess)
67
+ return null;
68
+ const members = input.typescriptItems.filter((item) => item.kind !== vscode_languageserver_types_1.CompletionItemKind.Text);
69
+ if (members.length === 0)
70
+ return null;
71
+ const receiver = input.receiver.replaceAll(COMMENTS, ' ');
72
+ const hasNew = input.hasNew === true || LEADING_NEW.test(receiver);
73
+ const prefix = receiver.replace(LEADING_NEW, '').replaceAll(/\s+/g, '') + '.';
74
+ const catalogue = new Map();
75
+ for (const item of input.catalogueItems) {
76
+ if (item.label.startsWith(prefix) &&
77
+ !catalogue.has(item.label) &&
78
+ !INSTANCE_PLACEHOLDER_TYPES.has(item.data?.type)) {
79
+ catalogue.set(item.label, item);
80
+ }
81
+ }
82
+ return members.map((member) => {
83
+ const known = catalogue.get(prefix + member.label);
84
+ if (!known)
85
+ return member;
86
+ const enriched = { ...member };
87
+ if (known.detail !== undefined)
88
+ enriched.detail = known.detail;
89
+ if (known.documentation !== undefined)
90
+ enriched.documentation = known.documentation;
91
+ if (known.tags !== undefined)
92
+ enriched.tags = known.tags;
93
+ if (known.data !== undefined)
94
+ enriched.data = known.data;
95
+ // a constructor's insert text starts with `new`, which only fits where the document has it
96
+ const insertText = known.insertText === undefined || (!hasNew && LEADING_NEW.test(known.insertText))
97
+ ? undefined
98
+ : memberInsertText(known.insertText, known.label, member.label);
99
+ if (insertText !== undefined) {
100
+ enriched.insertText = insertText;
101
+ if (known.insertTextFormat !== undefined) {
102
+ enriched.insertTextFormat = known.insertTextFormat;
103
+ }
104
+ }
105
+ return enriched;
106
+ });
107
+ }
108
+ //# sourceMappingURL=orchestration.js.map
@@ -0,0 +1,59 @@
1
+ import type { CompletionItem } from 'vscode-languageserver-types';
2
+ /**
3
+ * Keep only the SSJS of a mixed document. Everything else becomes spaces (line breaks stay), so
4
+ * every offset and position of the result is one of the document.
5
+ * @param text - full mixed document
6
+ * @returns text of the same length holding only the bodies of server-side scripts
7
+ */
8
+ export declare function ssjsProjection(text: string): string;
9
+ /**
10
+ * Tell whether an offset lies in the body of a server-side script. Both ends count, so a cursor
11
+ * right before the closing tag is still inside.
12
+ * @param text - full mixed document
13
+ * @param offset - zero-based UTF-16 offset
14
+ * @returns true if the offset is inside SSJS
15
+ */
16
+ export declare function isInSsjsRegion(text: string, offset: number): boolean;
17
+ /**
18
+ * Input of {@link memberCompletions}.
19
+ */
20
+ export interface MemberCompletionsInput {
21
+ /**
22
+ * What the TypeScript service offers at the cursor.
23
+ */
24
+ typescriptItems: readonly CompletionItem[];
25
+ /**
26
+ * Whether the cursor follows a member access, like `Platform.Function.` or `rows.`.
27
+ */
28
+ isMemberAccess: boolean;
29
+ /**
30
+ * The catalogue's SSJS completions, whose labels carry their objects: `Platform.Function.Lookup`.
31
+ */
32
+ catalogueItems: readonly CompletionItem[];
33
+ /**
34
+ * Source text of the expression in front of the member's dot, like `Platform.Function`.
35
+ * White space, comments and a leading `new` are ignored.
36
+ */
37
+ receiver: string;
38
+ /**
39
+ * Whether `new` precedes the receiver in the document, as in `new Script.Util.`. Without it,
40
+ * the catalogue's insert text of a constructor is not taken, as it would lack the `new`. A
41
+ * receiver that itself starts with `new` counts as well.
42
+ */
43
+ hasNew?: boolean;
44
+ }
45
+ /**
46
+ * The completions after a member access in SSJS. TypeScript decides which members exist; the
47
+ * catalogue describes those it knows.
48
+ *
49
+ * TypeScript's items are taken without its "unknown type" filler: for a receiver of type `any` it
50
+ * lists the names used in the file, as items of kind `Text`. Each remaining member is looked up in
51
+ * the catalogue as `<receiver>.<member>`. A match contributes `detail`, `documentation`,
52
+ * `insertText` (cut down to the member), `insertTextFormat`, `tags` and `data`; the member keeps
53
+ * its short label, which is what is shown and filtered by. The insert text of a constructor is
54
+ * left out where the document has no `new` in front of the receiver.
55
+ * @param input - TypeScript's items, the catalogue's items and the receiver
56
+ * @returns the members, or null if TypeScript knows none and the caller should use its own path
57
+ */
58
+ export declare function memberCompletions(input: MemberCompletionsInput): CompletionItem[] | null;
59
+ //# sourceMappingURL=orchestration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"orchestration.d.ts","sourceRoot":"","sources":["../../../src/typescript/orchestration.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAGlE;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAKpE;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACnC;;OAEG;IACH,eAAe,EAAE,SAAS,cAAc,EAAE,CAAC;IAC3C;;OAEG;IACH,cAAc,EAAE,OAAO,CAAC;IACxB;;OAEG;IACH,cAAc,EAAE,SAAS,cAAc,EAAE,CAAC;IAC1C;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CACpB;AA4BD;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,GAAG,cAAc,EAAE,GAAG,IAAI,CA0CxF"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"orchestration.js","sourceRoot":"","sources":["../../../src/typescript/orchestration.ts"],"names":[],"mappings":";;AAeA,wCAEC;AASD,wCAKC;AAsED,8CA0CC;AA/ID;;;;GAIG;AACH,6EAAiE;AAEjE,oDAA4E;AAE5E;;;;;GAKG;AACH,SAAgB,cAAc,CAAC,IAAY;IACvC,OAAO,IAAA,gCAAmB,EAAC,IAAI,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;AACpD,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,cAAc,CAAC,IAAY,EAAE,MAAc;IACvD,OAAO,IAAA,6BAAgB,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