@simplysm/sd-cli 14.0.16 → 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.
- package/README.md +2 -1
- package/dist/angular/client-transform-stylesheet.d.ts +2 -0
- package/dist/angular/client-transform-stylesheet.d.ts.map +1 -1
- package/dist/angular/client-transform-stylesheet.js +88 -2
- package/dist/angular/client-transform-stylesheet.js.map +1 -1
- package/dist/angular/vite-angular-plugin.d.ts +7 -0
- package/dist/angular/vite-angular-plugin.d.ts.map +1 -1
- package/dist/angular/vite-angular-plugin.js +78 -16
- package/dist/angular/vite-angular-plugin.js.map +1 -1
- package/dist/capacitor/capacitor.d.ts.map +1 -1
- package/dist/capacitor/capacitor.js +9 -13
- package/dist/capacitor/capacitor.js.map +1 -1
- package/dist/commands/check.d.ts.map +1 -1
- package/dist/commands/check.js +8 -9
- package/dist/commands/check.js.map +1 -1
- package/dist/commands/device.d.ts.map +1 -1
- package/dist/commands/device.js +33 -1
- package/dist/commands/device.js.map +1 -1
- package/dist/commands/lint.d.ts +0 -1
- package/dist/commands/lint.d.ts.map +1 -1
- package/dist/commands/lint.js +2 -3
- package/dist/commands/lint.js.map +1 -1
- package/dist/commands/publish.js +2 -2
- package/dist/commands/publish.js.map +1 -1
- package/dist/commands/typecheck.d.ts.map +1 -1
- package/dist/commands/typecheck.js +0 -1
- package/dist/commands/typecheck.js.map +1 -1
- package/dist/electron/electron.d.ts +3 -2
- package/dist/electron/electron.d.ts.map +1 -1
- package/dist/electron/electron.js +54 -31
- package/dist/electron/electron.js.map +1 -1
- package/dist/engines/BaseEngine.js +1 -1
- package/dist/engines/BaseEngine.js.map +1 -1
- package/dist/engines/NgtscEngine.d.ts.map +1 -1
- package/dist/engines/NgtscEngine.js +0 -1
- package/dist/engines/NgtscEngine.js.map +1 -1
- package/dist/engines/ServerEsbuildEngine.d.ts.map +1 -1
- package/dist/engines/ServerEsbuildEngine.js +0 -1
- package/dist/engines/ServerEsbuildEngine.js.map +1 -1
- package/dist/engines/TscEngine.d.ts.map +1 -1
- package/dist/engines/TscEngine.js +0 -1
- package/dist/engines/TscEngine.js.map +1 -1
- package/dist/engines/ViteEngine.d.ts.map +1 -1
- package/dist/engines/ViteEngine.js +8 -1
- package/dist/engines/ViteEngine.js.map +1 -1
- package/dist/engines/index.d.ts +0 -10
- package/dist/engines/index.d.ts.map +1 -1
- package/dist/engines/index.js +0 -5
- package/dist/engines/index.js.map +1 -1
- package/dist/engines/types.d.ts +0 -1
- package/dist/engines/types.d.ts.map +1 -1
- package/dist/infra/SignalHandler.d.ts +1 -6
- package/dist/infra/SignalHandler.d.ts.map +1 -1
- package/dist/infra/SignalHandler.js +4 -13
- package/dist/infra/SignalHandler.js.map +1 -1
- package/dist/orchestrators/BuildOrchestrator.d.ts.map +1 -1
- package/dist/orchestrators/BuildOrchestrator.js +7 -12
- package/dist/orchestrators/BuildOrchestrator.js.map +1 -1
- package/dist/orchestrators/DevWatchOrchestrator.d.ts.map +1 -1
- package/dist/orchestrators/DevWatchOrchestrator.js +17 -10
- package/dist/orchestrators/DevWatchOrchestrator.js.map +1 -1
- package/dist/sd-cli-entry.d.ts +0 -1
- package/dist/sd-cli-entry.d.ts.map +1 -1
- package/dist/sd-cli-entry.js +7 -8
- package/dist/sd-cli-entry.js.map +1 -1
- package/dist/sd-config.types.d.ts +11 -1
- package/dist/sd-config.types.d.ts.map +1 -1
- package/dist/utils/angular-compiler.d.ts.map +1 -1
- package/dist/utils/angular-compiler.js +20 -13
- package/dist/utils/angular-compiler.js.map +1 -1
- package/dist/utils/esbuild-config.d.ts +1 -1
- package/dist/utils/esbuild-config.d.ts.map +1 -1
- package/dist/utils/esbuild-config.js +1 -4
- package/dist/utils/esbuild-config.js.map +1 -1
- package/dist/utils/ngtsc-build-core.d.ts.map +1 -1
- package/dist/utils/ngtsc-build-core.js +3 -0
- package/dist/utils/ngtsc-build-core.js.map +1 -1
- package/dist/utils/tsc-build.d.ts +5 -0
- package/dist/utils/tsc-build.d.ts.map +1 -1
- package/dist/utils/tsc-build.js +2 -1
- package/dist/utils/tsc-build.js.map +1 -1
- package/dist/utils/vite-config.d.ts +1 -1
- package/dist/utils/vite-config.d.ts.map +1 -1
- package/dist/utils/vite-config.js +22 -53
- package/dist/utils/vite-config.js.map +1 -1
- package/dist/utils/vite-pwa-plugin.d.ts +9 -0
- package/dist/utils/vite-pwa-plugin.d.ts.map +1 -0
- package/dist/utils/vite-pwa-plugin.js +139 -0
- package/dist/utils/vite-pwa-plugin.js.map +1 -0
- package/dist/utils/worker-utils.d.ts +2 -5
- package/dist/utils/worker-utils.d.ts.map +1 -1
- package/dist/utils/worker-utils.js +5 -11
- package/dist/utils/worker-utils.js.map +1 -1
- package/dist/workers/client.worker.d.ts.map +1 -1
- package/dist/workers/client.worker.js +9 -3
- package/dist/workers/client.worker.js.map +1 -1
- package/dist/workers/library-build.worker.d.ts.map +1 -1
- package/dist/workers/library-build.worker.js +6 -2
- package/dist/workers/library-build.worker.js.map +1 -1
- package/dist/workers/ngtsc-build.worker.js +2 -2
- package/dist/workers/ngtsc-build.worker.js.map +1 -1
- package/dist/workers/server-build.worker.d.ts.map +1 -1
- package/dist/workers/server-build.worker.js +6 -2
- package/dist/workers/server-build.worker.js.map +1 -1
- package/dist/workers/server-runtime.worker.js +4 -4
- package/dist/workers/server-runtime.worker.js.map +1 -1
- package/docs/config.md +26 -0
- package/docs/pwa-configuration-types.md +1 -1
- package/package.json +8 -10
- package/src/angular/client-transform-stylesheet.ts +104 -2
- package/src/angular/vite-angular-plugin.ts +92 -31
- package/src/capacitor/capacitor.ts +10 -26
- package/src/commands/check.ts +8 -11
- package/src/commands/device.ts +38 -3
- package/src/commands/lint.ts +2 -3
- package/src/commands/publish.ts +2 -2
- package/src/commands/typecheck.ts +0 -1
- package/src/electron/electron.ts +62 -43
- package/src/engines/BaseEngine.ts +1 -1
- package/src/engines/NgtscEngine.ts +0 -1
- package/src/engines/ServerEsbuildEngine.ts +0 -1
- package/src/engines/TscEngine.ts +0 -1
- package/src/engines/ViteEngine.ts +7 -1
- package/src/engines/index.ts +0 -10
- package/src/engines/types.ts +0 -1
- package/src/infra/SignalHandler.ts +4 -14
- package/src/orchestrators/BuildOrchestrator.ts +7 -9
- package/src/orchestrators/DevWatchOrchestrator.ts +21 -9
- package/src/sd-cli-entry.ts +11 -16
- package/src/sd-config.types.ts +12 -1
- package/src/utils/angular-compiler.ts +21 -21
- package/src/utils/esbuild-config.ts +2 -5
- package/src/utils/ngtsc-build-core.ts +7 -0
- package/src/utils/tsc-build.ts +7 -0
- package/src/utils/vite-config.ts +23 -55
- package/src/utils/vite-pwa-plugin.ts +168 -0
- package/src/utils/worker-utils.ts +5 -11
- package/src/workers/client.worker.ts +11 -3
- package/src/workers/library-build.worker.ts +6 -2
- package/src/workers/ngtsc-build.worker.ts +2 -2
- package/src/workers/server-build.worker.ts +7 -2
- package/src/workers/server-runtime.worker.ts +4 -4
- package/tests/angular/client-transform-stylesheet.spec.ts +43 -0
- package/tests/angular/find-affected-by-scss.spec.ts +37 -0
- package/tests/angular/fixtures/basic-app/scss/_colors.scss +1 -0
- package/tests/angular/fixtures/basic-app/scss/_variables.scss +3 -0
- package/tests/angular/fixtures/basic-app/src/styled.component.ts +14 -0
- package/tests/angular/linker-disk-cache.spec.ts +158 -0
- package/tests/angular/scss-disk-cache.spec.ts +162 -0
- package/tests/angular/vite-angular-plugin-hmr-fallback.spec.ts +15 -15
- package/tests/angular/vite-angular-plugin-hmr.spec.ts +9 -9
- package/tests/angular/vite-angular-plugin-lint.spec.ts +4 -4
- package/tests/angular/vite-angular-plugin-scss-hmr.spec.ts +87 -0
- package/tests/angular/vite-angular-plugin.spec.ts +15 -15
- package/tests/capacitor/capacitor-icon.spec.ts +2 -4
- package/tests/capacitor/capacitor-init.spec.ts +2 -4
- package/tests/capacitor/capacitor-workspace.spec.ts +2 -4
- package/tests/commands/device.spec.ts +100 -0
- package/tests/electron/electron.spec.ts +24 -17
- package/tests/engines/ngtsc-engine.spec.ts +0 -3
- package/tests/engines/server-esbuild-engine.spec.ts +0 -3
- package/tests/engines/tsc-engine.spec.ts +1 -2
- package/tests/engines/vite-engine.spec.ts +0 -2
- package/tests/infra/signal-handler.spec.ts +1 -12
- package/tests/orchestrators/build-orchestrator.spec.ts +0 -6
- package/tests/orchestrators/dev-watch-orchestrator.spec.ts +24 -66
- package/tests/utils/angular-compiler.spec.ts +1396 -32
- package/tests/utils/esbuild-config.spec.ts +4 -7
- package/tests/utils/{ngtsc-build-core-angular-compiler.spec.ts → ngtsc-build-core.spec.ts} +142 -11
- package/tests/utils/tsc-build.spec.ts +4 -1
- package/tests/utils/vite-config.spec.ts +130 -261
- package/tests/utils/vite-pwa-plugin.acc.spec.ts +143 -0
- package/tests/utils/vite-pwa-plugin.spec.ts +350 -0
- package/tests/utils/worker-utils.spec.ts +8 -7
- package/tests/workers/client-worker.spec.ts +50 -1
- package/tests/workers/dev-port-file.verify.md +6 -0
- package/tests/workers/library-build-lint.spec.ts +1 -1
- package/tests/workers/library-build-worker.spec.ts +1 -1
- package/tests/workers/ngtsc-build-lint.spec.ts +1 -1
- package/tests/workers/server-build-lint.spec.ts +1 -1
- package/tests/workers/server-build-worker.spec.ts +1 -1
- package/tests/workers/server-runtime-worker.spec.ts +8 -1
- package/dist/infra/WorkerManager.d.ts +0 -40
- package/dist/infra/WorkerManager.d.ts.map +0 -1
- package/dist/infra/WorkerManager.js +0 -59
- package/dist/infra/WorkerManager.js.map +0 -1
- package/dist/utils/SdCliReporter.d.ts +0 -18
- package/dist/utils/SdCliReporter.d.ts.map +0 -1
- package/dist/utils/SdCliReporter.js +0 -144
- package/dist/utils/SdCliReporter.js.map +0 -1
- package/src/infra/WorkerManager.ts +0 -65
- package/src/utils/SdCliReporter.ts +0 -177
- package/tests/angular/scss-compiler-async.spec.ts +0 -54
- package/tests/commands/dev.spec.ts +0 -53
- package/tests/commands/watch.spec.ts +0 -53
- package/tests/infra/worker-manager.spec.ts +0 -63
- package/tests/utils/angular-compiler-emit.spec.ts +0 -570
- package/tests/utils/angular-compiler-init.spec.ts +0 -705
- package/tests/utils/angular-compiler-update.spec.ts +0 -293
- package/tests/utils/build-env.spec.ts +0 -33
- package/tests/utils/ngtsc-build-core-transform-stylesheet.spec.ts +0 -124
- package/tests/utils/ngtsc-scss-refactor.spec.ts +0 -47
|
@@ -162,7 +162,7 @@ describe("writeChangedOutputFiles", () => {
|
|
|
162
162
|
it("skips writing when transformed content matches existing file", async () => {
|
|
163
163
|
vi.mocked(mockFs.readFile).mockResolvedValue('import { bar } from "./bar.js";' as any);
|
|
164
164
|
|
|
165
|
-
|
|
165
|
+
await writeChangedOutputFiles([
|
|
166
166
|
{
|
|
167
167
|
path: "/pkg/dist/foo.js",
|
|
168
168
|
text: 'import { bar } from "./bar";',
|
|
@@ -170,13 +170,12 @@ describe("writeChangedOutputFiles", () => {
|
|
|
170
170
|
] as any);
|
|
171
171
|
|
|
172
172
|
expect(mockFs.writeFile).not.toHaveBeenCalled();
|
|
173
|
-
expect(hasChanges).toBe(false);
|
|
174
173
|
});
|
|
175
174
|
|
|
176
|
-
it("writes file
|
|
175
|
+
it("writes file when content changed", async () => {
|
|
177
176
|
vi.mocked(mockFs.readFile).mockResolvedValue('import { old } from "./old.js";' as any);
|
|
178
177
|
|
|
179
|
-
|
|
178
|
+
await writeChangedOutputFiles([
|
|
180
179
|
{
|
|
181
180
|
path: "/pkg/dist/foo.js",
|
|
182
181
|
text: 'import { bar } from "./bar";',
|
|
@@ -184,13 +183,12 @@ describe("writeChangedOutputFiles", () => {
|
|
|
184
183
|
] as any);
|
|
185
184
|
|
|
186
185
|
expect(mockFs.writeFile).toHaveBeenCalled();
|
|
187
|
-
expect(hasChanges).toBe(true);
|
|
188
186
|
});
|
|
189
187
|
|
|
190
188
|
it("writes new file when existing file does not exist", async () => {
|
|
191
189
|
vi.mocked(mockFs.readFile).mockRejectedValue(new Error("ENOENT"));
|
|
192
190
|
|
|
193
|
-
|
|
191
|
+
await writeChangedOutputFiles([
|
|
194
192
|
{
|
|
195
193
|
path: "/pkg/dist/foo.js",
|
|
196
194
|
text: 'const x = 1;',
|
|
@@ -199,7 +197,6 @@ describe("writeChangedOutputFiles", () => {
|
|
|
199
197
|
|
|
200
198
|
expect(mockFs.mkdir).toHaveBeenCalledWith(path.dirname("/pkg/dist/foo.js"), { recursive: true });
|
|
201
199
|
expect(mockFs.writeFile).toHaveBeenCalledWith("/pkg/dist/foo.js", "const x = 1;");
|
|
202
|
-
expect(hasChanges).toBe(true);
|
|
203
200
|
});
|
|
204
201
|
|
|
205
202
|
it("does not transform non-.js files", async () => {
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { describe, it, expect, vi, beforeEach } from "vitest";
|
|
2
2
|
import ts from "typescript";
|
|
3
3
|
|
|
4
|
-
// ---
|
|
4
|
+
// --- Mock: AngularCompiler를 사용하는지 검증 ---
|
|
5
5
|
|
|
6
|
-
// Mock AngularCompiler to verify runNgtscBuild uses it
|
|
7
6
|
const mockInitialize = vi.fn().mockResolvedValue({ affectedFiles: new Set() });
|
|
8
7
|
const mockCollectDiagnostics = vi.fn().mockReturnValue([]);
|
|
9
8
|
const mockEmitAffectedFiles = vi.fn().mockReturnValue([]);
|
|
@@ -42,7 +41,6 @@ vi.mock("../../src/utils/angular-compiler", () => {
|
|
|
42
41
|
};
|
|
43
42
|
});
|
|
44
43
|
|
|
45
|
-
// Mock tsconfig module to avoid filesystem access
|
|
46
44
|
vi.mock("../../src/utils/tsconfig", () => ({
|
|
47
45
|
parseTsconfig: vi.fn().mockReturnValue({
|
|
48
46
|
options: {
|
|
@@ -60,7 +58,6 @@ vi.mock("../../src/utils/tsconfig", () => ({
|
|
|
60
58
|
getCompilerOptionsForEnv: vi.fn().mockImplementation((opts: ts.CompilerOptions) => opts),
|
|
61
59
|
}));
|
|
62
60
|
|
|
63
|
-
// Mock NgtscProgram should NOT be used after migration
|
|
64
61
|
const ngtscProgramSpy = vi.fn();
|
|
65
62
|
vi.mock("../../src/utils/angular-build", () => {
|
|
66
63
|
class NgtscProgram {
|
|
@@ -90,11 +87,18 @@ vi.mock("../../src/utils/angular-build", () => {
|
|
|
90
87
|
};
|
|
91
88
|
});
|
|
92
89
|
|
|
93
|
-
const {
|
|
90
|
+
const {
|
|
91
|
+
runNgtscBuild,
|
|
92
|
+
createLibraryTransformStylesheet,
|
|
93
|
+
buildScssLoadPaths,
|
|
94
|
+
} = await import("../../src/utils/ngtsc-build-core");
|
|
95
|
+
|
|
96
|
+
import { resolve, join } from "node:path";
|
|
94
97
|
|
|
95
|
-
// Use real workspace root so ts.readConfigFile can find tsconfig.json
|
|
96
|
-
const { resolve } = await import("node:path");
|
|
97
98
|
const workspaceRoot = resolve(import.meta.dirname, "../../../..");
|
|
99
|
+
const angularPkgDir = resolve(workspaceRoot, "packages/angular");
|
|
100
|
+
|
|
101
|
+
// ─── runNgtscBuild가 AngularCompiler를 사용한다 ───
|
|
98
102
|
|
|
99
103
|
describe("runNgtscBuild가 AngularCompiler를 사용한다", () => {
|
|
100
104
|
beforeEach(() => {
|
|
@@ -111,14 +115,10 @@ describe("runNgtscBuild가 AngularCompiler를 사용한다", () => {
|
|
|
111
115
|
output: { js: true, dts: true },
|
|
112
116
|
});
|
|
113
117
|
|
|
114
|
-
// AngularCompiler가 생성됨
|
|
115
118
|
expect(angularCompilerConstructorSpy).toHaveBeenCalledTimes(1);
|
|
116
|
-
// initialize()가 호출됨
|
|
117
119
|
expect(mockInitialize).toHaveBeenCalledTimes(1);
|
|
118
|
-
// NgtscProgram이 직접 생성되지 않음
|
|
119
120
|
expect(ngtscProgramSpy).not.toHaveBeenCalled();
|
|
120
121
|
|
|
121
|
-
// 결과 구조 확인
|
|
122
122
|
expect(result.build).toHaveProperty("success");
|
|
123
123
|
expect(result.build).toHaveProperty("diagnostics");
|
|
124
124
|
});
|
|
@@ -170,3 +170,134 @@ describe("runNgtscBuild가 AngularCompiler를 사용한다", () => {
|
|
|
170
170
|
expect(options.compilerOptions.noEmit).toBe(true);
|
|
171
171
|
});
|
|
172
172
|
});
|
|
173
|
+
|
|
174
|
+
// ─── createLibraryTransformStylesheet ───
|
|
175
|
+
|
|
176
|
+
describe("createLibraryTransformStylesheet", () => {
|
|
177
|
+
beforeEach(() => {
|
|
178
|
+
vi.restoreAllMocks();
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
it("외부 .scss 파일이면 compileScssFile로 CSS를 반환하고 의존성을 기록한다", async () => {
|
|
182
|
+
const loadPaths = ["/pkg/scss", "/cwd/node_modules"];
|
|
183
|
+
const scssErrors: string[] = [];
|
|
184
|
+
const scssDependencies = new Map<string, Set<string>>();
|
|
185
|
+
|
|
186
|
+
const transform = createLibraryTransformStylesheet(loadPaths, scssErrors, scssDependencies);
|
|
187
|
+
|
|
188
|
+
const result = await transform(
|
|
189
|
+
".host { color: red; }",
|
|
190
|
+
"/project/src/app.component.ts",
|
|
191
|
+
"/project/src/app.component.scss",
|
|
192
|
+
);
|
|
193
|
+
|
|
194
|
+
expect(scssErrors.length).toBeGreaterThan(0);
|
|
195
|
+
expect(result).toBe("/* SCSS compilation error */");
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
it("외부 .css 파일이면 null을 반환한다", async () => {
|
|
199
|
+
const loadPaths = ["/pkg/scss"];
|
|
200
|
+
const scssErrors: string[] = [];
|
|
201
|
+
const scssDependencies = new Map<string, Set<string>>();
|
|
202
|
+
|
|
203
|
+
const transform = createLibraryTransformStylesheet(loadPaths, scssErrors, scssDependencies);
|
|
204
|
+
|
|
205
|
+
const result = await transform(
|
|
206
|
+
".host { color: red; }",
|
|
207
|
+
"/project/src/app.component.ts",
|
|
208
|
+
"/project/src/app.component.css",
|
|
209
|
+
);
|
|
210
|
+
|
|
211
|
+
expect(result).toBeNull();
|
|
212
|
+
expect(scssErrors.length).toBe(0);
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
it("인라인 SCSS(stylesheetFile 미지정)이면 compileScssString으로 CSS를 반환한다", async () => {
|
|
216
|
+
const loadPaths: string[] = [];
|
|
217
|
+
const scssErrors: string[] = [];
|
|
218
|
+
const scssDependencies = new Map<string, Set<string>>();
|
|
219
|
+
|
|
220
|
+
const transform = createLibraryTransformStylesheet(loadPaths, scssErrors, scssDependencies);
|
|
221
|
+
|
|
222
|
+
const result = await transform(
|
|
223
|
+
".host { color: red; }",
|
|
224
|
+
"/project/src/app.component.ts",
|
|
225
|
+
undefined,
|
|
226
|
+
);
|
|
227
|
+
|
|
228
|
+
expect(typeof result).toBe("string");
|
|
229
|
+
expect(result).toContain("color: red");
|
|
230
|
+
expect(scssErrors.length).toBe(0);
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
it("SCSS 컴파일 에러 시 scssErrors에 에러를 추가하고 에러 주석을 반환한다", async () => {
|
|
234
|
+
const loadPaths: string[] = [];
|
|
235
|
+
const scssErrors: string[] = [];
|
|
236
|
+
const scssDependencies = new Map<string, Set<string>>();
|
|
237
|
+
|
|
238
|
+
const transform = createLibraryTransformStylesheet(loadPaths, scssErrors, scssDependencies);
|
|
239
|
+
|
|
240
|
+
const result = await transform(
|
|
241
|
+
"",
|
|
242
|
+
"/project/src/broken.component.ts",
|
|
243
|
+
"/nonexistent/path/broken.scss",
|
|
244
|
+
);
|
|
245
|
+
|
|
246
|
+
expect(result).toBe("/* SCSS compilation error */");
|
|
247
|
+
expect(scssErrors.length).toBeGreaterThan(0);
|
|
248
|
+
expect(scssErrors[0]).toContain("SCSS error");
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
it("SCSS 의존성이 scssDependencies에 기록된다", async () => {
|
|
252
|
+
const loadPaths: string[] = [];
|
|
253
|
+
const scssErrors: string[] = [];
|
|
254
|
+
const scssDependencies = new Map<string, Set<string>>();
|
|
255
|
+
|
|
256
|
+
const transform = createLibraryTransformStylesheet(loadPaths, scssErrors, scssDependencies);
|
|
257
|
+
|
|
258
|
+
await transform(
|
|
259
|
+
".host { color: red; }",
|
|
260
|
+
"/project/src/app.component.ts",
|
|
261
|
+
undefined,
|
|
262
|
+
);
|
|
263
|
+
|
|
264
|
+
expect(scssDependencies.has("/project/src/app.component.ts")).toBe(true);
|
|
265
|
+
});
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
// ─── buildScssLoadPaths ───
|
|
269
|
+
|
|
270
|
+
describe("buildScssLoadPaths", () => {
|
|
271
|
+
it("returns [pkgDir/scss, cwd/node_modules] for given NgtscBuildInfo", () => {
|
|
272
|
+
const info = {
|
|
273
|
+
name: "angular",
|
|
274
|
+
cwd: workspaceRoot,
|
|
275
|
+
pkgDir: angularPkgDir,
|
|
276
|
+
output: { js: true, dts: false },
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
const result = buildScssLoadPaths(info);
|
|
280
|
+
|
|
281
|
+
expect(result).toEqual([
|
|
282
|
+
join(angularPkgDir, "scss"),
|
|
283
|
+
join(workspaceRoot, "node_modules"),
|
|
284
|
+
]);
|
|
285
|
+
});
|
|
286
|
+
|
|
287
|
+
it("uses cwd from info to construct node_modules path", () => {
|
|
288
|
+
const customCwd = "/custom/workspace";
|
|
289
|
+
const customPkgDir = "/custom/workspace/packages/my-pkg";
|
|
290
|
+
|
|
291
|
+
const result = buildScssLoadPaths({
|
|
292
|
+
name: "test",
|
|
293
|
+
cwd: customCwd,
|
|
294
|
+
pkgDir: customPkgDir,
|
|
295
|
+
output: { js: true, dts: false },
|
|
296
|
+
});
|
|
297
|
+
|
|
298
|
+
expect(result).toEqual([
|
|
299
|
+
join(customPkgDir, "scss"),
|
|
300
|
+
join(customCwd, "node_modules"),
|
|
301
|
+
]);
|
|
302
|
+
});
|
|
303
|
+
});
|
|
@@ -176,11 +176,12 @@ describe("runTscPackageBuild", () => {
|
|
|
176
176
|
output: { js: true, dts: true },
|
|
177
177
|
});
|
|
178
178
|
|
|
179
|
-
// createEmitAndSemanticDiagnosticsBuilderProgram(rootNames, options, host)
|
|
179
|
+
// createEmitAndSemanticDiagnosticsBuilderProgram(rootNames, options, host, oldBuilderProgram)
|
|
180
180
|
expect(vi.mocked(tsModule.default.createEmitAndSemanticDiagnosticsBuilderProgram)).toHaveBeenCalledWith(
|
|
181
181
|
[SRC_INDEX, SRC_UTIL],
|
|
182
182
|
expect.any(Object),
|
|
183
183
|
expect.any(Object),
|
|
184
|
+
undefined,
|
|
184
185
|
);
|
|
185
186
|
});
|
|
186
187
|
|
|
@@ -198,6 +199,7 @@ describe("runTscPackageBuild", () => {
|
|
|
198
199
|
[SRC_INDEX, SRC_UTIL],
|
|
199
200
|
expect.any(Object),
|
|
200
201
|
expect.any(Object),
|
|
202
|
+
undefined,
|
|
201
203
|
);
|
|
202
204
|
});
|
|
203
205
|
|
|
@@ -216,6 +218,7 @@ describe("runTscPackageBuild", () => {
|
|
|
216
218
|
[SRC_INDEX, SRC_UTIL, TEST_INDEX],
|
|
217
219
|
expect.any(Object),
|
|
218
220
|
expect.any(Object),
|
|
221
|
+
undefined,
|
|
219
222
|
);
|
|
220
223
|
});
|
|
221
224
|
|