@macroforge/svelte-preprocessor 0.1.65 → 0.1.66

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
@@ -11,21 +11,24 @@ Svelte preprocessor for expanding Macroforge macros in component script blocks
11
11
  Svelte preprocessor for expanding Macroforge macros in component script blocks.
12
12
 
13
13
  This module provides integration between Macroforge's macro expansion system and
14
- Svelte's preprocessing pipeline. It intercepts `<script>` blocks in `.svelte` files,
15
- detects `@derive` decorators, and expands them into generated code before TypeScript
16
- compilation occurs.
14
+ Svelte's preprocessing pipeline. It intercepts `<script>` blocks in `.svelte`
15
+ files, detects `@derive` decorators, and expands them into generated code before
16
+ TypeScript compilation occurs.
17
17
 
18
18
  ## How It Works
19
19
 
20
- 1. The preprocessor is registered in `svelte.config.js` as part of the preprocess array
21
- 2. When Svelte compiles a component, it passes each `<script>` block to this preprocessor
20
+ 1. The preprocessor is registered in `svelte.config.js` as part of the
21
+ preprocess array
22
+ 2. When Svelte compiles a component, it passes each `<script>` block to this
23
+ preprocessor
22
24
  3. The preprocessor checks if the script contains `@derive` decorators
23
25
  4. If found, it calls the native `macroforge` binding to expand the macros
24
26
  5. The expanded code replaces the original script content
25
27
 
26
28
  ## Important Notes
27
29
 
28
- - Must be placed BEFORE other preprocessors (like `vitePreprocess()`) in the chain
30
+ - Must be placed BEFORE other preprocessors (like `vitePreprocess()`) in the
31
+ chain
29
32
  - Uses lazy-loading for native bindings to avoid initialization overhead
30
33
  - Gracefully degrades if native bindings are unavailable
31
34
  - Only processes TypeScript blocks by default (configurable via options)
@@ -40,24 +43,29 @@ npm install @macroforge/svelte-preprocessor
40
43
 
41
44
  ### Functions
42
45
 
43
- - **`macroforgePreprocess`** - Whether to preserve `@derive` decorators in the expanded output.
46
+ - **`macroforgePreprocess`** - Whether to preserve `@derive` decorators in the
47
+ expanded output.
44
48
 
45
49
  ### Types
46
50
 
47
- - **`ExpandResult`** - Whether to preserve `@derive` decorators in the expanded output.
48
- - **`MacroforgePreprocessorOptions`** - Configuration options for the Macroforge Svelte preprocessor.
51
+ - **`ExpandResult`** - Whether to preserve `@derive` decorators in the expanded
52
+ output.
53
+ - **`MacroforgePreprocessorOptions`** - Configuration options for the Macroforge
54
+ Svelte preprocessor.
49
55
 
50
56
  ## Examples
51
57
 
52
58
  ```typescript
53
- macroforgePreprocess()
54
- macroforgePreprocess({ keepDecorators: true })
55
- macroforgePreprocess({ processJavaScript: true })
59
+ macroforgePreprocess();
60
+ macroforgePreprocess({ keepDecorators: true });
61
+ macroforgePreprocess({ processJavaScript: true });
56
62
  ```
57
63
 
58
64
  ## Documentation
59
65
 
60
- See the [full documentation](https://macroforge.dev/docs/api/reference/typescript/svelte-preprocessor) on the Macroforge website.
66
+ See the
67
+ [full documentation](https://macroforge.dev/docs/api/reference/typescript/svelte-preprocessor)
68
+ on the Macroforge website.
61
69
 
62
70
  ## License
63
71
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAgB,MAAM,iBAAiB,CAAC;AAuIvE;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,WAAW,6BAA6B;IAC5C;;;;;;;;;;OAUG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB;;;;;;;;;;;;;OAaG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,GAAE,6BAAkC,GAC1C,iBAAiB,CAkJnB;AAED;;;;;;;GAOG;AACH,eAAe,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,KAAK,EAAgB,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAyIvE;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,WAAW,6BAA6B;IAC5C;;;;;;;;;;OAUG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB;;;;;;;;;;;;;OAaG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,GAAE,6BAAkC,GAC1C,iBAAiB,CAkJnB;AAED;;;;;;;GAOG;AACH,eAAe,oBAAoB,CAAC"}
package/dist/index.js CHANGED
@@ -169,7 +169,8 @@ export function macroforgePreprocess(options = {}) {
169
169
  */
170
170
  const lang = attributes.lang || attributes.type;
171
171
  const isTypeScript = lang === "ts" || lang === "typescript";
172
- const isJavaScript = !lang || lang === "js" || lang === "javascript" || lang === "module";
172
+ const isJavaScript = !lang || lang === "js" || lang === "javascript" ||
173
+ lang === "module";
173
174
  // Skip non-TypeScript blocks unless processJavaScript is enabled
174
175
  if (!isTypeScript && !(processJavaScript && isJavaScript)) {
175
176
  return; // Return undefined = no changes, Svelte keeps original content
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "dependencies": {
3
- "macroforge": "^0.1.65"
3
+ "macroforge": "^0.1.66"
4
4
  },
5
5
  "description": "Svelte preprocessor for expanding Macroforge macros in component script blocks",
6
6
  "devDependencies": {
@@ -32,10 +32,10 @@
32
32
  "scripts": {
33
33
  "build": "tsc -p tsconfig.json",
34
34
  "clean": "rm -rf dist",
35
- "cleanbuild": "npm run clean && npm run build",
36
- "test": "npm run build && node --test tests/**/*.test.js"
35
+ "cleanbuild": "deno task clean && deno task build",
36
+ "test": "deno task build && node --test tests/**/*.test.js"
37
37
  },
38
38
  "type": "module",
39
39
  "types": "dist/index.d.ts",
40
- "version": "0.1.65"
40
+ "version": "0.1.66"
41
41
  }