@macroforge/typescript-plugin 0.1.66 → 0.1.67

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.
package/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # @macroforge/typescript-plugin
2
2
 
3
- TypeScript language service plugin that augments classes decorated with @derive to include macro-generated methods.
3
+ TypeScript language service plugin that augments classes decorated with @derive to include
4
+ macro-generated methods.
4
5
 
5
6
  [![npm version](https://badge.fury.io/js/%40macroforge%2Ftypescript-plugin.svg)](https://www.npmjs.com/package/@macroforge/typescript-plugin)
6
7
 
@@ -8,23 +9,23 @@ TypeScript language service plugin that augments classes decorated with @derive
8
9
 
9
10
  TypeScript Language Service Plugin for Macroforge
10
11
 
11
- This plugin integrates Macroforge's compile-time macro expansion with TypeScript's
12
- Language Service to provide seamless IDE support for macro-decorated classes.
12
+ This plugin integrates Macroforge's compile-time macro expansion with TypeScript's Language Service
13
+ to provide seamless IDE support for macro-decorated classes.
13
14
 
14
15
  ## Architecture Overview
15
16
 
16
- The plugin operates by intercepting TypeScript's Language Service methods and
17
- transforming source code on-the-fly:
17
+ The plugin operates by intercepting TypeScript's Language Service methods and transforming source
18
+ code on-the-fly:
18
19
 
19
- 1. **Macro Expansion**: When TypeScript requests a file's content via `getScriptSnapshot`,
20
- this plugin intercepts the call and returns the macro-expanded version instead.
20
+ 1. **Macro Expansion**: When TypeScript requests a file's content via `getScriptSnapshot`, this
21
+ plugin intercepts the call and returns the macro-expanded version instead.
21
22
 
22
- 2. **Position Mapping**: Since expanded code has different positions than the original,
23
- the plugin maintains a {@link PositionMapper} for each file to translate positions
24
- between original and expanded coordinates.
23
+ 2. **Position Mapping**: Since expanded code has different positions than the original, the plugin
24
+ maintains a {@link PositionMapper} for each file to translate positions between original and
25
+ expanded coordinates.
25
26
 
26
- 3. **Virtual .d.ts Files**: For each macro-containing file, the plugin generates a
27
- companion `.macroforge.d.ts` file containing type declarations for generated methods.
27
+ 3. **Virtual .d.ts Files**: For each macro-containing file, the plugin generates a companion
28
+ `.macroforge.d.ts` file containing type declarations for generated methods.
28
29
 
29
30
  ## Supported File Types
30
31
 
@@ -41,6 +42,7 @@ The plugin hooks into three categories of Language Service methods:
41
42
  - **Navigation hooks**: Handle go-to-definition, references, completions, etc.
42
43
 
43
44
  @example
45
+
44
46
  ```typescript
45
47
  {
46
48
  "compilerOptions": {
@@ -59,15 +61,19 @@ npm install @macroforge/typescript-plugin
59
61
 
60
62
  ### Functions
61
63
 
62
- - **`parseMacroImportComments`** - Parses macro import comments to extract macro name to module path mappings.
64
+ - **`parseMacroImportComments`** - Parses macro import comments to extract macro name to module path
65
+ mappings.
63
66
  - **`getExternalManifest`** - Attempts to load the manifest from an external macro package.
64
67
  - **`getExternalMacroInfo`** - Looks up macro info from an external package manifest.
65
68
  - **`getExternalDecoratorInfo`** - Looks up decorator info from an external package manifest.
66
- - **`findDeriveAtPosition`** - Finds a macro name within `@derive(...)` decorators at a given cursor position.
69
+ - **`findDeriveAtPosition`** - Finds a macro name within `@derive(...)` decorators at a given cursor
70
+ position.
67
71
  - **`findDeriveKeywordAtPosition`** - Finds the `@derive` keyword at a given cursor position.
68
- - **`findDecoratorAtPosition`** - Finds a field decorator (like `@serde` or `@debug`) at a given cursor position.
72
+ - **`findDecoratorAtPosition`** - Finds a field decorator (like `@serde` or `@debug`) at a given
73
+ cursor position.
69
74
  - **`findEnclosingDeriveContext`** - const lastCommentEnd = beforeMatch.lastIndexOf("*/
70
- - **`getMacroHoverInfo`** - Generates hover information (QuickInfo) for macros and decorators at a cursor position.
75
+ - **`getMacroHoverInfo`** - Generates hover information (QuickInfo) for macros and decorators at a
76
+ cursor position.
71
77
  - **`shouldProcess`** - Determines whether a file should be processed for macro expansion.
72
78
  - ... and 7 more
73
79
 
@@ -87,7 +93,8 @@ npm install @macroforge/typescript-plugin
87
93
 
88
94
  ## Documentation
89
95
 
90
- See the [full documentation](https://macroforge.dev/docs/api/reference/typescript/typescript-plugin) on the Macroforge website.
96
+ See the [full documentation](https://macroforge.dev/docs/api/reference/typescript/typescript-plugin)
97
+ on the Macroforge website.
91
98
 
92
99
  ## License
93
100
 
package/dist/index.d.ts CHANGED
@@ -13,7 +13,7 @@
13
13
  * this plugin intercepts the call and returns the macro-expanded version instead.
14
14
  *
15
15
  * 2. **Position Mapping**: Since expanded code has different positions than the original,
16
- * the plugin maintains a {@link PositionMapper} for each file to translate positions
16
+ * the plugin maintains a PositionMapper for each file to translate positions
17
17
  * between original and expanded coordinates.
18
18
  *
19
19
  * 3. **Virtual .d.ts Files**: For each macro-containing file, the plugin generates a
@@ -44,10 +44,10 @@
44
44
  * ```
45
45
  *
46
46
  * @see {@link init} - The main plugin factory function
47
- * @see {@link PositionMapper} - Position mapping between original and expanded code
47
+ * @see PositionMapper from macroforge - Position mapping between original and expanded code
48
48
  * @module @macroforge/typescript-plugin
49
49
  */
50
- import type ts from "typescript/lib/tsserverlibrary";
50
+ import type ts from 'typescript/lib/tsserverlibrary';
51
51
  /**
52
52
  * Main plugin factory function conforming to the TypeScript Language Service Plugin API.
53
53
  *
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AAEH,OAAO,KAAK,EAAE,MAAM,gCAAgC,CAAC;AAqqBrD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AACH,iBAAS,IAAI,CAAC,OAAO,EAAE;IAAE,UAAU,EAAE,OAAO,EAAE,CAAA;CAAE;mBAcxB,EAAE,CAAC,MAAM,CAAC,gBAAgB;EAm/DjD;AAED,eAAe,IAAI,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AAEH,OAAO,KAAK,EAAE,MAAM,gCAAgC,CAAC;AA0qBrD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AACH,iBAAS,IAAI,CAAC,OAAO,EAAE;IAAE,UAAU,EAAE,OAAO,EAAE,CAAA;CAAE;mBActB,EAAE,CAAC,MAAM,CAAC,gBAAgB;EAyhEnD;AAED,eAAe,IAAI,CAAC"}