@simplysm/sd-cli 14.0.15 → 14.0.17

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 (216) hide show
  1. package/README.md +4 -3
  2. package/dist/angular/client-transform-stylesheet.d.ts +2 -0
  3. package/dist/angular/client-transform-stylesheet.d.ts.map +1 -1
  4. package/dist/angular/client-transform-stylesheet.js +88 -2
  5. package/dist/angular/client-transform-stylesheet.js.map +1 -1
  6. package/dist/angular/vite-angular-plugin.d.ts +7 -0
  7. package/dist/angular/vite-angular-plugin.d.ts.map +1 -1
  8. package/dist/angular/vite-angular-plugin.js +78 -16
  9. package/dist/angular/vite-angular-plugin.js.map +1 -1
  10. package/dist/capacitor/capacitor.d.ts.map +1 -1
  11. package/dist/capacitor/capacitor.js +24 -13
  12. package/dist/capacitor/capacitor.js.map +1 -1
  13. package/dist/commands/check.d.ts.map +1 -1
  14. package/dist/commands/check.js +8 -9
  15. package/dist/commands/check.js.map +1 -1
  16. package/dist/commands/device.d.ts +1 -1
  17. package/dist/commands/device.d.ts.map +1 -1
  18. package/dist/commands/device.js +61 -12
  19. package/dist/commands/device.js.map +1 -1
  20. package/dist/commands/lint.d.ts +0 -1
  21. package/dist/commands/lint.d.ts.map +1 -1
  22. package/dist/commands/lint.js +2 -3
  23. package/dist/commands/lint.js.map +1 -1
  24. package/dist/commands/publish.js +3 -3
  25. package/dist/commands/publish.js.map +1 -1
  26. package/dist/commands/replace-deps.js +1 -1
  27. package/dist/commands/replace-deps.js.map +1 -1
  28. package/dist/commands/typecheck.d.ts.map +1 -1
  29. package/dist/commands/typecheck.js +1 -2
  30. package/dist/commands/typecheck.js.map +1 -1
  31. package/dist/electron/electron.d.ts +3 -2
  32. package/dist/electron/electron.d.ts.map +1 -1
  33. package/dist/electron/electron.js +54 -31
  34. package/dist/electron/electron.js.map +1 -1
  35. package/dist/engines/BaseEngine.js +1 -1
  36. package/dist/engines/BaseEngine.js.map +1 -1
  37. package/dist/engines/NgtscEngine.d.ts.map +1 -1
  38. package/dist/engines/NgtscEngine.js +0 -1
  39. package/dist/engines/NgtscEngine.js.map +1 -1
  40. package/dist/engines/ServerEsbuildEngine.d.ts.map +1 -1
  41. package/dist/engines/ServerEsbuildEngine.js +0 -1
  42. package/dist/engines/ServerEsbuildEngine.js.map +1 -1
  43. package/dist/engines/TscEngine.d.ts.map +1 -1
  44. package/dist/engines/TscEngine.js +0 -1
  45. package/dist/engines/TscEngine.js.map +1 -1
  46. package/dist/engines/ViteEngine.d.ts.map +1 -1
  47. package/dist/engines/ViteEngine.js +10 -1
  48. package/dist/engines/ViteEngine.js.map +1 -1
  49. package/dist/engines/index.d.ts +0 -10
  50. package/dist/engines/index.d.ts.map +1 -1
  51. package/dist/engines/index.js +0 -5
  52. package/dist/engines/index.js.map +1 -1
  53. package/dist/engines/types.d.ts +0 -1
  54. package/dist/engines/types.d.ts.map +1 -1
  55. package/dist/infra/SignalHandler.d.ts +1 -6
  56. package/dist/infra/SignalHandler.d.ts.map +1 -1
  57. package/dist/infra/SignalHandler.js +4 -13
  58. package/dist/infra/SignalHandler.js.map +1 -1
  59. package/dist/orchestrators/BuildOrchestrator.d.ts.map +1 -1
  60. package/dist/orchestrators/BuildOrchestrator.js +7 -12
  61. package/dist/orchestrators/BuildOrchestrator.js.map +1 -1
  62. package/dist/orchestrators/DevWatchOrchestrator.d.ts.map +1 -1
  63. package/dist/orchestrators/DevWatchOrchestrator.js +18 -11
  64. package/dist/orchestrators/DevWatchOrchestrator.js.map +1 -1
  65. package/dist/sd-cli-entry.d.ts +0 -1
  66. package/dist/sd-cli-entry.d.ts.map +1 -1
  67. package/dist/sd-cli-entry.js +13 -16
  68. package/dist/sd-cli-entry.js.map +1 -1
  69. package/dist/sd-cli.js +1 -1
  70. package/dist/sd-cli.js.map +1 -1
  71. package/dist/sd-config.types.d.ts +12 -2
  72. package/dist/sd-config.types.d.ts.map +1 -1
  73. package/dist/utils/angular-compiler.d.ts.map +1 -1
  74. package/dist/utils/angular-compiler.js +20 -13
  75. package/dist/utils/angular-compiler.js.map +1 -1
  76. package/dist/utils/esbuild-config.d.ts +1 -1
  77. package/dist/utils/esbuild-config.d.ts.map +1 -1
  78. package/dist/utils/esbuild-config.js +1 -4
  79. package/dist/utils/esbuild-config.js.map +1 -1
  80. package/dist/utils/ngtsc-build-core.d.ts.map +1 -1
  81. package/dist/utils/ngtsc-build-core.js +3 -0
  82. package/dist/utils/ngtsc-build-core.js.map +1 -1
  83. package/dist/utils/orchestrator-utils.js +1 -1
  84. package/dist/utils/orchestrator-utils.js.map +1 -1
  85. package/dist/utils/tsc-build.d.ts +5 -0
  86. package/dist/utils/tsc-build.d.ts.map +1 -1
  87. package/dist/utils/tsc-build.js +2 -1
  88. package/dist/utils/tsc-build.js.map +1 -1
  89. package/dist/utils/vite-config.d.ts +1 -1
  90. package/dist/utils/vite-config.d.ts.map +1 -1
  91. package/dist/utils/vite-config.js +22 -53
  92. package/dist/utils/vite-config.js.map +1 -1
  93. package/dist/utils/vite-pwa-plugin.d.ts +9 -0
  94. package/dist/utils/vite-pwa-plugin.d.ts.map +1 -0
  95. package/dist/utils/vite-pwa-plugin.js +139 -0
  96. package/dist/utils/vite-pwa-plugin.js.map +1 -0
  97. package/dist/utils/worker-utils.d.ts +2 -5
  98. package/dist/utils/worker-utils.d.ts.map +1 -1
  99. package/dist/utils/worker-utils.js +5 -11
  100. package/dist/utils/worker-utils.js.map +1 -1
  101. package/dist/workers/client.worker.d.ts.map +1 -1
  102. package/dist/workers/client.worker.js +9 -3
  103. package/dist/workers/client.worker.js.map +1 -1
  104. package/dist/workers/library-build.worker.d.ts.map +1 -1
  105. package/dist/workers/library-build.worker.js +6 -2
  106. package/dist/workers/library-build.worker.js.map +1 -1
  107. package/dist/workers/ngtsc-build.worker.js +2 -2
  108. package/dist/workers/ngtsc-build.worker.js.map +1 -1
  109. package/dist/workers/server-build.worker.d.ts.map +1 -1
  110. package/dist/workers/server-build.worker.js +6 -2
  111. package/dist/workers/server-build.worker.js.map +1 -1
  112. package/dist/workers/server-runtime.worker.js +4 -4
  113. package/dist/workers/server-runtime.worker.js.map +1 -1
  114. package/docs/config.md +30 -2
  115. package/docs/pwa-configuration-types.md +1 -1
  116. package/package.json +8 -10
  117. package/src/angular/client-transform-stylesheet.ts +104 -2
  118. package/src/angular/vite-angular-plugin.ts +92 -31
  119. package/src/capacitor/capacitor.ts +25 -26
  120. package/src/commands/check.ts +8 -11
  121. package/src/commands/device.ts +71 -17
  122. package/src/commands/lint.ts +2 -3
  123. package/src/commands/publish.ts +3 -3
  124. package/src/commands/replace-deps.ts +1 -1
  125. package/src/commands/typecheck.ts +1 -2
  126. package/src/electron/electron.ts +62 -43
  127. package/src/engines/BaseEngine.ts +1 -1
  128. package/src/engines/NgtscEngine.ts +0 -1
  129. package/src/engines/ServerEsbuildEngine.ts +0 -1
  130. package/src/engines/TscEngine.ts +0 -1
  131. package/src/engines/ViteEngine.ts +9 -1
  132. package/src/engines/index.ts +0 -10
  133. package/src/engines/types.ts +0 -1
  134. package/src/infra/SignalHandler.ts +4 -14
  135. package/src/orchestrators/BuildOrchestrator.ts +7 -9
  136. package/src/orchestrators/DevWatchOrchestrator.ts +22 -10
  137. package/src/sd-cli-entry.ts +17 -24
  138. package/src/sd-cli.ts +1 -1
  139. package/src/sd-config.types.ts +13 -2
  140. package/src/utils/angular-compiler.ts +21 -21
  141. package/src/utils/esbuild-config.ts +2 -5
  142. package/src/utils/ngtsc-build-core.ts +7 -0
  143. package/src/utils/orchestrator-utils.ts +1 -1
  144. package/src/utils/tsc-build.ts +7 -0
  145. package/src/utils/vite-config.ts +23 -55
  146. package/src/utils/vite-pwa-plugin.ts +168 -0
  147. package/src/utils/worker-utils.ts +5 -11
  148. package/src/workers/client.worker.ts +11 -3
  149. package/src/workers/library-build.worker.ts +6 -2
  150. package/src/workers/ngtsc-build.worker.ts +2 -2
  151. package/src/workers/server-build.worker.ts +7 -2
  152. package/src/workers/server-runtime.worker.ts +4 -4
  153. package/tests/angular/client-transform-stylesheet.spec.ts +43 -0
  154. package/tests/angular/find-affected-by-scss.spec.ts +37 -0
  155. package/tests/angular/fixtures/basic-app/scss/_colors.scss +1 -0
  156. package/tests/angular/fixtures/basic-app/scss/_variables.scss +3 -0
  157. package/tests/angular/fixtures/basic-app/src/styled.component.ts +14 -0
  158. package/tests/angular/linker-disk-cache.spec.ts +158 -0
  159. package/tests/angular/scss-disk-cache.spec.ts +162 -0
  160. package/tests/angular/vite-angular-plugin-hmr-fallback.spec.ts +15 -15
  161. package/tests/angular/vite-angular-plugin-hmr.spec.ts +9 -9
  162. package/tests/angular/vite-angular-plugin-lint.spec.ts +4 -4
  163. package/tests/angular/vite-angular-plugin-scss-hmr.spec.ts +87 -0
  164. package/tests/angular/vite-angular-plugin.spec.ts +15 -15
  165. package/tests/capacitor/capacitor-icon.spec.ts +2 -4
  166. package/tests/capacitor/capacitor-init.spec.ts +2 -4
  167. package/tests/capacitor/capacitor-workspace.spec.ts +2 -4
  168. package/tests/commands/device.spec.ts +108 -8
  169. package/tests/commands/publish.spec.ts +2 -2
  170. package/tests/commands/typecheck.spec.ts +1 -1
  171. package/tests/electron/electron.spec.ts +24 -17
  172. package/tests/engines/ngtsc-engine.spec.ts +0 -3
  173. package/tests/engines/server-esbuild-engine.spec.ts +0 -3
  174. package/tests/engines/tsc-engine.spec.ts +1 -2
  175. package/tests/engines/vite-engine.spec.ts +0 -2
  176. package/tests/infra/signal-handler.spec.ts +1 -12
  177. package/tests/orchestrators/build-orchestrator.spec.ts +1 -7
  178. package/tests/orchestrators/dev-watch-orchestrator.spec.ts +24 -66
  179. package/tests/utils/angular-compiler.spec.ts +1396 -32
  180. package/tests/utils/esbuild-config.spec.ts +4 -7
  181. package/tests/utils/{ngtsc-build-core-angular-compiler.spec.ts → ngtsc-build-core.spec.ts} +142 -11
  182. package/tests/utils/orchestrator-utils.spec.ts +2 -2
  183. package/tests/utils/sd-config.spec.ts +2 -2
  184. package/tests/utils/tsc-build.spec.ts +4 -1
  185. package/tests/utils/vite-config.spec.ts +130 -261
  186. package/tests/utils/vite-pwa-plugin.acc.spec.ts +143 -0
  187. package/tests/utils/vite-pwa-plugin.spec.ts +350 -0
  188. package/tests/utils/worker-utils.spec.ts +8 -7
  189. package/tests/workers/client-worker.spec.ts +50 -1
  190. package/tests/workers/dev-port-file.verify.md +6 -0
  191. package/tests/workers/library-build-lint.spec.ts +1 -1
  192. package/tests/workers/library-build-worker.spec.ts +1 -1
  193. package/tests/workers/ngtsc-build-lint.spec.ts +1 -1
  194. package/tests/workers/server-build-lint.spec.ts +1 -1
  195. package/tests/workers/server-build-worker.spec.ts +1 -1
  196. package/tests/workers/server-runtime-worker.spec.ts +8 -1
  197. package/dist/infra/WorkerManager.d.ts +0 -40
  198. package/dist/infra/WorkerManager.d.ts.map +0 -1
  199. package/dist/infra/WorkerManager.js +0 -59
  200. package/dist/infra/WorkerManager.js.map +0 -1
  201. package/dist/utils/SdCliReporter.d.ts +0 -18
  202. package/dist/utils/SdCliReporter.d.ts.map +0 -1
  203. package/dist/utils/SdCliReporter.js +0 -144
  204. package/dist/utils/SdCliReporter.js.map +0 -1
  205. package/src/infra/WorkerManager.ts +0 -65
  206. package/src/utils/SdCliReporter.ts +0 -177
  207. package/tests/angular/scss-compiler-async.spec.ts +0 -54
  208. package/tests/commands/dev.spec.ts +0 -53
  209. package/tests/commands/watch.spec.ts +0 -53
  210. package/tests/infra/worker-manager.spec.ts +0 -63
  211. package/tests/utils/angular-compiler-emit.spec.ts +0 -570
  212. package/tests/utils/angular-compiler-init.spec.ts +0 -705
  213. package/tests/utils/angular-compiler-update.spec.ts +0 -293
  214. package/tests/utils/build-env.spec.ts +0 -33
  215. package/tests/utils/ngtsc-build-core-transform-stylesheet.spec.ts +0 -124
  216. package/tests/utils/ngtsc-scss-refactor.spec.ts +0 -47
@@ -0,0 +1,162 @@
1
+ import { describe, it, expect, beforeEach, afterEach } from "vitest";
2
+ import fs from "fs";
3
+ import path from "path";
4
+ import os from "os";
5
+ import { createClientTransformStylesheet } from "../../src/angular/client-transform-stylesheet.js";
6
+
7
+ const TMP_DIR = path.join(os.tmpdir(), "sd-cli-scss-cache-test");
8
+ const CACHE_DIR = path.join(TMP_DIR, "scss-cache");
9
+
10
+ function ensureTmpDir(): void {
11
+ fs.mkdirSync(TMP_DIR, { recursive: true });
12
+ }
13
+
14
+ describe("SCSS disk cache", () => {
15
+ beforeEach(() => {
16
+ ensureTmpDir();
17
+ });
18
+
19
+ afterEach(() => {
20
+ fs.rmSync(TMP_DIR, { recursive: true, force: true });
21
+ });
22
+
23
+ // Acceptance: cache miss → compile + store, cache hit → load from disk
24
+ it("caches SCSS compile result on miss and returns cached on hit", async () => {
25
+ const scssPath = path.join(TMP_DIR, "component.scss");
26
+ fs.writeFileSync(scssPath, "$color: blue;\n.host { color: $color; }");
27
+
28
+ const deps = new Map<string, Set<string>>();
29
+ const transform = createClientTransformStylesheet({
30
+ loadPaths: [],
31
+ scssErrors: [],
32
+ scssDependencies: deps,
33
+ cacheDir: CACHE_DIR,
34
+ });
35
+
36
+ // First call: compile (cache miss)
37
+ const result1 = await transform("", path.join(TMP_DIR, "component.ts"), scssPath);
38
+ expect(result1).toContain("color: blue");
39
+
40
+ // Cache file should exist
41
+ const cacheFiles = fs.readdirSync(CACHE_DIR);
42
+ expect(cacheFiles.length).toBe(1);
43
+
44
+ // Second call: cache hit (same file)
45
+ deps.clear();
46
+ const result2 = await transform("", path.join(TMP_DIR, "component.ts"), scssPath);
47
+ expect(result2).toBe(result1);
48
+ });
49
+
50
+ // Acceptance: dependency change → cache miss
51
+ it("invalidates cache when dependency file changes", async () => {
52
+ const partialPath = path.join(TMP_DIR, "_vars.scss");
53
+ fs.writeFileSync(partialPath, "$color: green;");
54
+ const scssPath = path.join(TMP_DIR, "with-dep.scss");
55
+ fs.writeFileSync(scssPath, '@use "vars";\n.host { color: vars.$color; }');
56
+
57
+ const deps = new Map<string, Set<string>>();
58
+ const transform = createClientTransformStylesheet({
59
+ loadPaths: [TMP_DIR],
60
+ scssErrors: [],
61
+ scssDependencies: deps,
62
+ cacheDir: CACHE_DIR,
63
+ });
64
+
65
+ // First call
66
+ const result1 = await transform("", path.join(TMP_DIR, "comp.ts"), scssPath);
67
+ expect(result1).toContain("color: green");
68
+
69
+ // Change dependency content
70
+ fs.writeFileSync(partialPath, "$color: red;");
71
+
72
+ const result2 = await transform("", path.join(TMP_DIR, "comp.ts"), scssPath);
73
+ expect(result2).toContain("color: red");
74
+ expect(result2).not.toContain("color: green");
75
+ });
76
+
77
+ // Acceptance: scssDependencies populated on cache hit
78
+ it("populates scssDependencies from cache on hit", async () => {
79
+ const partialPath = path.join(TMP_DIR, "_shared.scss");
80
+ fs.writeFileSync(partialPath, "$size: 14px;");
81
+ const scssPath = path.join(TMP_DIR, "deptest.scss");
82
+ fs.writeFileSync(scssPath, '@use "shared";\n.text { font-size: shared.$size; }');
83
+
84
+ const deps = new Map<string, Set<string>>();
85
+ const transform = createClientTransformStylesheet({
86
+ loadPaths: [TMP_DIR],
87
+ scssErrors: [],
88
+ scssDependencies: deps,
89
+ cacheDir: CACHE_DIR,
90
+ });
91
+
92
+ // First call: populate deps from compilation
93
+ await transform("", path.join(TMP_DIR, "comp.ts"), scssPath);
94
+ expect(deps.size).toBeGreaterThan(0);
95
+
96
+ // Clear deps and call again (cache hit)
97
+ deps.clear();
98
+ await transform("", path.join(TMP_DIR, "comp.ts"), scssPath);
99
+
100
+ // deps should be re-populated from cache
101
+ expect(deps.size).toBeGreaterThan(0);
102
+ const depSet = deps.get(scssPath);
103
+ expect(depSet).toBeDefined();
104
+ expect(depSet!.size).toBeGreaterThan(0);
105
+ });
106
+
107
+ // Unit: inline SCSS is NOT cached
108
+ it("does not cache inline SCSS", async () => {
109
+ const deps = new Map<string, Set<string>>();
110
+ const transform = createClientTransformStylesheet({
111
+ loadPaths: [],
112
+ scssErrors: [],
113
+ scssDependencies: deps,
114
+ cacheDir: CACHE_DIR,
115
+ });
116
+
117
+ await transform(
118
+ "$size: 14px;\n.text { font-size: $size; }",
119
+ path.join(TMP_DIR, "component.ts"),
120
+ );
121
+
122
+ // No cache files should be created for inline SCSS
123
+ expect(fs.existsSync(CACHE_DIR)).toBe(false);
124
+ });
125
+
126
+ // Unit: file content change → cache miss
127
+ it("invalidates cache when SCSS file content changes", async () => {
128
+ const scssPath = path.join(TMP_DIR, "changing.scss");
129
+ fs.writeFileSync(scssPath, ".host { color: blue; }");
130
+
131
+ const transform = createClientTransformStylesheet({
132
+ loadPaths: [],
133
+ scssErrors: [],
134
+ scssDependencies: new Map(),
135
+ cacheDir: CACHE_DIR,
136
+ });
137
+
138
+ const result1 = await transform("", path.join(TMP_DIR, "comp.ts"), scssPath);
139
+ expect(result1).toContain("color: blue");
140
+
141
+ fs.writeFileSync(scssPath, ".host { color: red; }");
142
+
143
+ const result2 = await transform("", path.join(TMP_DIR, "comp.ts"), scssPath);
144
+ expect(result2).toContain("color: red");
145
+ });
146
+
147
+ // Unit: no cacheDir → no caching (backward compatible)
148
+ it("works without cacheDir (no caching)", async () => {
149
+ const scssPath = path.join(TMP_DIR, "nodir.scss");
150
+ fs.writeFileSync(scssPath, ".host { color: navy; }");
151
+
152
+ const transform = createClientTransformStylesheet({
153
+ loadPaths: [],
154
+ scssErrors: [],
155
+ scssDependencies: new Map(),
156
+ });
157
+
158
+ const result = await transform("", path.join(TMP_DIR, "comp.ts"), scssPath);
159
+ expect(result).toContain("color: navy");
160
+ expect(fs.existsSync(CACHE_DIR)).toBe(false);
161
+ });
162
+ });
@@ -28,7 +28,7 @@ describe("sdAngularPlugin CSS HMR compatibility", () => {
28
28
  .join(FIXTURE_DIR, "node_modules/@scope/lib/dist/style.css")
29
29
  .replace(/\\/g, "/");
30
30
 
31
- const hmrResult = await (plugin as any).handleHotUpdate?.({
31
+ const hmrResult = await (plugin as any).hotUpdate?.({
32
32
  file: cssFilePath,
33
33
  modules: [{ file: cssFilePath, id: cssFilePath }],
34
34
  server: { watcher: { emit: vi.fn() } },
@@ -68,7 +68,7 @@ describe("sdAngularPlugin CSS HMR compatibility", () => {
68
68
  .join(FIXTURE_DIR, "src/app.component.ts")
69
69
  .replace(/\\/g, "/");
70
70
 
71
- await (plugin as any).handleHotUpdate?.({
71
+ await (plugin as any).hotUpdate?.({
72
72
  file: tsFilePath,
73
73
  modules: [{ file: tsFilePath, id: tsFilePath }],
74
74
  server: { watcher: { emit: vi.fn() } },
@@ -88,7 +88,7 @@ describe("sdAngularPlugin CSS HMR compatibility", () => {
88
88
  .join(FIXTURE_DIR, "node_modules/@scope/lib/dist/style.css")
89
89
  .replace(/\\/g, "/");
90
90
 
91
- await (plugin as any).handleHotUpdate?.({
91
+ await (plugin as any).hotUpdate?.({
92
92
  file: cssFilePath,
93
93
  modules: [{ file: cssFilePath, id: cssFilePath }],
94
94
  server: { watcher: { emit: vi.fn() } },
@@ -121,7 +121,7 @@ describe("sdAngularPlugin CSS HMR compatibility", () => {
121
121
  ];
122
122
 
123
123
  for (const cssPath of cssVariants) {
124
- const result = await (plugin as any).handleHotUpdate?.({
124
+ const result = await (plugin as any).hotUpdate?.({
125
125
  file: cssPath,
126
126
  modules: [{ file: cssPath, id: cssPath }],
127
127
  server: { watcher: { emit: vi.fn() } },
@@ -159,7 +159,7 @@ describe("sdAngularPlugin CSS HMR compatibility", () => {
159
159
  .join(FIXTURE_DIR, "src/styles.scss")
160
160
  .replace(/\\/g, "/");
161
161
 
162
- const result = await (plugin as any).handleHotUpdate?.({
162
+ const result = await (plugin as any).hotUpdate?.({
163
163
  file: scssFilePath,
164
164
  modules: [{ file: scssFilePath, id: scssFilePath }],
165
165
  server: { watcher: { emit: vi.fn() } },
@@ -209,8 +209,8 @@ describe("sdAngularPlugin HMR fallback", () => {
209
209
  .join(FIXTURE_DIR, "src/app.component.ts")
210
210
  .replace(/\\/g, "/");
211
211
 
212
- // handleHotUpdate 호출
213
- const hmrResult = await (plugin as any).handleHotUpdate?.({
212
+ // hotUpdate 호출
213
+ const hmrResult = await (plugin as any).hotUpdate?.({
214
214
  file: appComponentPath,
215
215
  modules: [{ file: appComponentPath, id: appComponentPath }],
216
216
  server: { watcher: { emit: vi.fn() } },
@@ -218,7 +218,7 @@ describe("sdAngularPlugin HMR fallback", () => {
218
218
  read: () => Promise.resolve(""),
219
219
  });
220
220
 
221
- // handleHotUpdate는 항상 affected modules 배열을 반환해야 한다
221
+ // hotUpdate는 항상 affected modules 배열을 반환해야 한다
222
222
  // (templateUpdates가 undefined이든 아니든)
223
223
  expect(Array.isArray(hmrResult)).toBe(true);
224
224
 
@@ -249,8 +249,8 @@ describe("sdAngularPlugin HMR fallback", () => {
249
249
  await (plugin as any).buildEnd?.call({});
250
250
  });
251
251
 
252
- // Unit: prod 모드(dev: false)에서는 handleHotUpdate가 void 반환 (HMR 비활성)
253
- it("returns undefined from handleHotUpdate in prod mode", async () => {
252
+ // Unit: prod 모드(dev: false)에서는 hotUpdate가 void 반환 (HMR 비활성)
253
+ it("returns undefined from hotUpdate in prod mode", async () => {
254
254
  const plugin = sdAngularPlugin({
255
255
  tsconfig: TSCONFIG_PATH,
256
256
  dev: false,
@@ -262,7 +262,7 @@ describe("sdAngularPlugin HMR fallback", () => {
262
262
  .join(FIXTURE_DIR, "src/app.component.ts")
263
263
  .replace(/\\/g, "/");
264
264
 
265
- const hmrResult = await (plugin as any).handleHotUpdate?.({
265
+ const hmrResult = await (plugin as any).hotUpdate?.({
266
266
  file: appComponentPath,
267
267
  modules: [{ file: appComponentPath }],
268
268
  server: { watcher: { emit: vi.fn() } },
@@ -276,7 +276,7 @@ describe("sdAngularPlugin HMR fallback", () => {
276
276
  await (plugin as any).buildEnd?.call({});
277
277
  });
278
278
 
279
- // Acceptance: 수정 파일 33개 이상일 때도 handleHotUpdate가 정상 동작
279
+ // Acceptance: 수정 파일 33개 이상일 때도 hotUpdate가 정상 동작
280
280
  // (Angular 컴파일러 내부에서 HMR 분석을 생략하고 templateUpdates=undefined 반환)
281
281
  it("handles update with many modified files gracefully (HMR skipped by compiler)", async () => {
282
282
  const plugin = sdAngularPlugin({
@@ -290,11 +290,11 @@ describe("sdAngularPlugin HMR fallback", () => {
290
290
  .join(FIXTURE_DIR, "src/app.component.ts")
291
291
  .replace(/\\/g, "/");
292
292
 
293
- // handleHotUpdate는 단일 파일에 대해 호출됨 (Vite 설계)
293
+ // hotUpdate는 단일 파일에 대해 호출됨 (Vite 설계)
294
294
  // 33개 이상 수정 파일 제한은 Angular 컴파일러 내부에서 처리
295
295
  // AngularFacade.update()에서 modifiedFiles가 SourceFileCache.modifiedFiles로 전달되므로
296
296
  // 실제 33개 이상 파일 변경은 SourceFileCache를 통해 추적됨
297
- const hmrResult = await (plugin as any).handleHotUpdate?.({
297
+ const hmrResult = await (plugin as any).hotUpdate?.({
298
298
  file: appComponentPath,
299
299
  modules: [{ file: appComponentPath }],
300
300
  server: { watcher: { emit: vi.fn() } },
@@ -302,7 +302,7 @@ describe("sdAngularPlugin HMR fallback", () => {
302
302
  read: () => Promise.resolve(""),
303
303
  });
304
304
 
305
- // handleHotUpdate가 에러 없이 동작해야 한다
305
+ // hotUpdate가 에러 없이 동작해야 한다
306
306
  expect(Array.isArray(hmrResult)).toBe(true);
307
307
 
308
308
  await (plugin as any).buildEnd?.call({});
@@ -131,8 +131,8 @@ describe("sdAngularPlugin HMR + component-middleware", () => {
131
131
  await (plugin as any).buildEnd?.call({});
132
132
  });
133
133
 
134
- // Acceptance: handleHotUpdate에서 templateUpdates를 수집하고 middleware에서 서빙
135
- it("collects templateUpdates from handleHotUpdate and serves via middleware", async () => {
134
+ // Acceptance: hotUpdate에서 templateUpdates를 수집하고 middleware에서 서빙
135
+ it("collects templateUpdates from hotUpdate and serves via middleware", async () => {
136
136
  const plugin = sdAngularPlugin({ tsconfig: TSCONFIG_PATH, dev: true });
137
137
 
138
138
  await (plugin as any).buildStart?.call({});
@@ -151,12 +151,12 @@ describe("sdAngularPlugin HMR + component-middleware", () => {
151
151
  };
152
152
  (plugin as any).configureServer?.(mockServer);
153
153
 
154
- // handleHotUpdate 호출 (인라인 템플릿 변경)
154
+ // hotUpdate 호출 (인라인 템플릿 변경)
155
155
  const appComponentPath = path
156
156
  .join(FIXTURE_DIR, "src/app.component.ts")
157
157
  .replace(/\\/g, "/");
158
158
 
159
- await (plugin as any).handleHotUpdate?.({
159
+ await (plugin as any).hotUpdate?.({
160
160
  file: appComponentPath,
161
161
  modules: [{ file: appComponentPath, id: appComponentPath }],
162
162
  server: { watcher: { emit: vi.fn() } },
@@ -174,7 +174,7 @@ describe("sdAngularPlugin HMR + component-middleware", () => {
174
174
  });
175
175
 
176
176
  // Acceptance: rebuild 시작 시 이전 templateUpdates 정리
177
- it("clears templateUpdates at the start of handleHotUpdate", async () => {
177
+ it("clears templateUpdates at the start of hotUpdate", async () => {
178
178
  const plugin = sdAngularPlugin({ tsconfig: TSCONFIG_PATH, dev: true });
179
179
  await (plugin as any).buildStart?.call({});
180
180
 
@@ -195,8 +195,8 @@ describe("sdAngularPlugin HMR + component-middleware", () => {
195
195
  .join(FIXTURE_DIR, "src/app.component.ts")
196
196
  .replace(/\\/g, "/");
197
197
 
198
- // 첫 번째 handleHotUpdate
199
- await (plugin as any).handleHotUpdate?.({
198
+ // 첫 번째 hotUpdate
199
+ await (plugin as any).hotUpdate?.({
200
200
  file: appComponentPath,
201
201
  modules: [{ file: appComponentPath }],
202
202
  server: { watcher: { emit: vi.fn() } },
@@ -204,8 +204,8 @@ describe("sdAngularPlugin HMR + component-middleware", () => {
204
204
  read: () => Promise.resolve(""),
205
205
  });
206
206
 
207
- // 두 번째 handleHotUpdate — 이전 templateUpdates가 정리되어야 한다
208
- await (plugin as any).handleHotUpdate?.({
207
+ // 두 번째 hotUpdate — 이전 templateUpdates가 정리되어야 한다
208
+ await (plugin as any).hotUpdate?.({
209
209
  file: appComponentPath,
210
210
  modules: [{ file: appComponentPath }],
211
211
  server: { watcher: { emit: vi.fn() } },
@@ -145,7 +145,7 @@ describe("vite-angular-plugin lint integration (Slice 5)", () => {
145
145
  });
146
146
  });
147
147
 
148
- describe("Scenario: lint runs in handleHotUpdate", () => {
148
+ describe("Scenario: lint runs in hotUpdate", () => {
149
149
  it("runs lint after incremental compilation and passes result to onBuild", async () => {
150
150
  const onBuildResults: any[] = [];
151
151
 
@@ -167,9 +167,9 @@ describe("vite-angular-plugin lint integration (Slice 5)", () => {
167
167
  formattedOutput: "lint errors found",
168
168
  });
169
169
 
170
- // Call handleHotUpdate
171
- const handleHotUpdate = (plugin as any).handleHotUpdate;
172
- await handleHotUpdate.call({}, {
170
+ // Call hotUpdate
171
+ const hotUpdate = (plugin as any).hotUpdate;
172
+ await hotUpdate.call({}, {
173
173
  file: "/workspace/packages/client/src/app.ts",
174
174
  modules: [],
175
175
  server: {},
@@ -0,0 +1,87 @@
1
+ import { describe, it, expect, beforeAll, afterAll } from "vitest";
2
+ import path from "path";
3
+ import { sdAngularPlugin } from "../../src/angular/vite-angular-plugin.js";
4
+
5
+ const FIXTURE_DIR = path.resolve(import.meta.dirname, "fixtures/basic-app");
6
+ const TSCONFIG_PATH = path.join(FIXTURE_DIR, "tsconfig.json");
7
+
8
+ function mockEnvironmentContext() {
9
+ return {
10
+ environment: {
11
+ moduleGraph: {
12
+ getModulesByFile: (file: string) => {
13
+ return new Set([{ file, id: file }]);
14
+ },
15
+ },
16
+ },
17
+ };
18
+ }
19
+
20
+ describe("sdAngularPlugin SCSS @use HMR", () => {
21
+ let plugin: ReturnType<typeof sdAngularPlugin>;
22
+
23
+ beforeAll(async () => {
24
+ plugin = sdAngularPlugin({ tsconfig: TSCONFIG_PATH, dev: true });
25
+ await (plugin as any).buildStart?.call({});
26
+ });
27
+
28
+ afterAll(async () => {
29
+ await (plugin as any).buildEnd?.call({});
30
+ });
31
+
32
+ // Acceptance: inline styles의 직접 @use 의존성 변경 시 재컴파일
33
+ it("recompiles when inline SCSS @use dependency changes", async () => {
34
+ const variablesPath = path
35
+ .join(FIXTURE_DIR, "scss/_variables.scss")
36
+ .replace(/\\/g, "/");
37
+
38
+ const ctx = mockEnvironmentContext();
39
+ const result = await (plugin as any).hotUpdate?.call(ctx, {
40
+ file: variablesPath,
41
+ modules: [],
42
+ server: {},
43
+ timestamp: Date.now(),
44
+ read: () => Promise.resolve(""),
45
+ });
46
+
47
+ expect(result).toBeDefined();
48
+ expect(result!.length).toBeGreaterThan(0);
49
+ });
50
+
51
+ // Acceptance: inline styles의 간접 @use 의존성 변경 시 재컴파일 (체이닝)
52
+ it("recompiles when chained @use dependency changes", async () => {
53
+ const colorsPath = path
54
+ .join(FIXTURE_DIR, "scss/_colors.scss")
55
+ .replace(/\\/g, "/");
56
+
57
+ const ctx = mockEnvironmentContext();
58
+ const result = await (plugin as any).hotUpdate?.call(ctx, {
59
+ file: colorsPath,
60
+ modules: [],
61
+ server: {},
62
+ timestamp: Date.now(),
63
+ read: () => Promise.resolve(""),
64
+ });
65
+
66
+ expect(result).toBeDefined();
67
+ expect(result!.length).toBeGreaterThan(0);
68
+ });
69
+
70
+ // Acceptance: 무관한 SCSS 변경 시 재빌드하지 않음
71
+ it("does not recompile when unrelated SCSS changes", async () => {
72
+ const unrelatedPath = path
73
+ .join(FIXTURE_DIR, "scss/_unrelated.scss")
74
+ .replace(/\\/g, "/");
75
+
76
+ const ctx = mockEnvironmentContext();
77
+ const result = await (plugin as any).hotUpdate?.call(ctx, {
78
+ file: unrelatedPath,
79
+ modules: [],
80
+ server: {},
81
+ timestamp: Date.now(),
82
+ read: () => Promise.resolve(""),
83
+ });
84
+
85
+ expect(result).toBeUndefined();
86
+ });
87
+ });
@@ -54,7 +54,7 @@ describe("sdAngularPlugin", () => {
54
54
  });
55
55
 
56
56
  // Scenario: Angular 컴포넌트 .ts 파일 수정 시 컴포넌트 HMR (Acceptance — Feature 3.3)
57
- it("updates emit cache and returns affected modules when handleHotUpdate is called", async () => {
57
+ it("updates emit cache and returns affected modules when hotUpdate is called", async () => {
58
58
  const onBuildStart = vi.fn();
59
59
  const onBuild = vi.fn();
60
60
 
@@ -77,12 +77,12 @@ describe("sdAngularPlugin", () => {
77
77
  expect(initialResult).toBeDefined();
78
78
  expect(initialResult.code.length).toBeGreaterThan(0);
79
79
 
80
- // handleHotUpdate must exist
81
- expect((plugin as any).handleHotUpdate).toBeDefined();
80
+ // hotUpdate must exist
81
+ expect((plugin as any).hotUpdate).toBeDefined();
82
82
 
83
83
  // Simulate file change
84
84
  const mockModule = { file: appComponentPath, id: appComponentPath };
85
- const hmrResult = await (plugin as any).handleHotUpdate?.({
85
+ const hmrResult = await (plugin as any).hotUpdate?.({
86
86
  file: appComponentPath,
87
87
  modules: [mockModule],
88
88
  server: { watcher: { emit: vi.fn() } },
@@ -122,7 +122,7 @@ describe("sdAngularPlugin", () => {
122
122
  });
123
123
 
124
124
  // Scenario: 컴파일 에러 발생 및 복구 (Acceptance — Feature 3.3)
125
- it("calls onBuild with success=false when handleHotUpdate encounters compile error", async () => {
125
+ it("calls onBuild with success=false when hotUpdate encounters compile error", async () => {
126
126
  const onBuild = vi.fn();
127
127
  const plugin = sdAngularPlugin({
128
128
  tsconfig: TSCONFIG_PATH,
@@ -132,8 +132,8 @@ describe("sdAngularPlugin", () => {
132
132
 
133
133
  await (plugin as any).buildStart?.call({});
134
134
 
135
- // handleHotUpdate with a non-existent file — facade.update() should handle gracefully
136
- const _hmrResult = await (plugin as any).handleHotUpdate?.({
135
+ // hotUpdate with a non-existent file — facade.update() should handle gracefully
136
+ const _hmrResult = await (plugin as any).hotUpdate?.({
137
137
  file: path.join(FIXTURE_DIR, "src/nonexistent-file.ts").replace(/\\/g, "/"),
138
138
  modules: [],
139
139
  server: { watcher: { emit: vi.fn() } },
@@ -147,8 +147,8 @@ describe("sdAngularPlugin", () => {
147
147
  await (plugin as any).buildEnd?.call({});
148
148
  });
149
149
 
150
- // Scenario: non-Angular .ts 파일 수정 — handleHotUpdate passes through
151
- it("handleHotUpdate skips non-ts/html/scss files", async () => {
150
+ // Scenario: non-Angular .ts 파일 수정 — hotUpdate passes through
151
+ it("hotUpdate skips non-ts/html/scss files", async () => {
152
152
  const onBuildStart = vi.fn();
153
153
  const plugin = sdAngularPlugin({
154
154
  tsconfig: TSCONFIG_PATH,
@@ -159,7 +159,7 @@ describe("sdAngularPlugin", () => {
159
159
  await (plugin as any).buildStart?.call({});
160
160
 
161
161
  // .json file should be ignored
162
- const result = await (plugin as any).handleHotUpdate?.({
162
+ const result = await (plugin as any).hotUpdate?.({
163
163
  file: "/some/file.json",
164
164
  modules: [],
165
165
  server: {},
@@ -192,16 +192,16 @@ describe("sdAngularPlugin", () => {
192
192
  // (in real use, Vite server close triggers this)
193
193
  });
194
194
 
195
- // Scenario: optimizeDeps에 Angular Linker esbuild 플러그인이 등록된다 (Feature 1.1 Angular Linker)
196
- it("registers angular-vite-optimize-deps esbuild plugin in optimizeDeps config", () => {
195
+ // Scenario: optimizeDeps에 Angular Linker Rolldown 플러그인이 등록된다
196
+ it("registers angular-vite-optimize-deps rolldown plugin in optimizeDeps config", () => {
197
197
  const plugin = sdAngularPlugin({ tsconfig: TSCONFIG_PATH, dev: true });
198
198
  const config = (plugin as any).config?.();
199
199
 
200
- const esbuildPlugins = config?.optimizeDeps?.esbuildOptions?.plugins as
200
+ const rolldownPlugins = config?.optimizeDeps?.rolldownOptions?.plugins as
201
201
  | { name: string }[]
202
202
  | undefined;
203
- expect(esbuildPlugins).toBeDefined();
204
- expect(esbuildPlugins!.some((p) => p.name === "angular-vite-optimize-deps")).toBe(true);
203
+ expect(rolldownPlugins).toBeDefined();
204
+ expect(rolldownPlugins!.some((p) => p.name === "angular-vite-optimize-deps")).toBe(true);
205
205
  });
206
206
 
207
207
  // Scenario: .mjs 파일이 JavaScriptTransformer를 통과한다 (Feature 1.1 Angular Linker)
@@ -35,11 +35,9 @@ vi.mock("@simplysm/core-node", () => ({
35
35
  }));
36
36
 
37
37
  // env mock
38
- let mockEnv: Record<string, unknown> = {};
38
+ let mockEnv: Record<string, string | undefined> = {};
39
39
  vi.mock("@simplysm/core-common", () => ({
40
- env: new Proxy({} as Record<string, unknown>, {
41
- get: (_target, prop) => mockEnv[prop as string],
42
- }),
40
+ env: (key: string) => mockEnv[key],
43
41
  }));
44
42
 
45
43
  // cpx mock (was execa)
@@ -35,11 +35,9 @@ vi.mock("@simplysm/core-node", () => ({
35
35
  },
36
36
  }));
37
37
 
38
- let mockEnv: Record<string, unknown> = {};
38
+ let mockEnv: Record<string, string | undefined> = {};
39
39
  vi.mock("@simplysm/core-common", () => ({
40
- env: new Proxy({} as Record<string, unknown>, {
41
- get: (_target, prop) => mockEnv[prop as string],
42
- }),
40
+ env: (key: string) => mockEnv[key],
43
41
  }));
44
42
 
45
43
  const execaCalls: { command: string; args: string[] }[] = [];
@@ -35,11 +35,9 @@ vi.mock("@simplysm/core-node", () => ({
35
35
  },
36
36
  }));
37
37
 
38
- let mockEnv: Record<string, unknown> = {};
38
+ let mockEnv: Record<string, string | undefined> = {};
39
39
  vi.mock("@simplysm/core-common", () => ({
40
- env: new Proxy({} as Record<string, unknown>, {
41
- get: (_target, prop) => mockEnv[prop as string],
42
- }),
40
+ env: (key: string) => mockEnv[key],
43
41
  }));
44
42
 
45
43
  const execaCalls: { command: string; args: string[] }[] = [];