@embeddable.com/sdk-core 3.14.3-next.0 → 3.14.4-next.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@embeddable.com/sdk-core",
3
- "version": "3.14.3-next.0",
3
+ "version": "3.14.4-next.0",
4
4
  "description": "Core Embeddable SDK module responsible for web-components bundling and publishing.",
5
5
  "keywords": [
6
6
  "embeddable",
@@ -40,7 +40,7 @@
40
40
  },
41
41
  "license": "MIT",
42
42
  "dependencies": {
43
- "@embeddable.com/core": "2.10.3-next.0",
43
+ "@embeddable.com/core": "2.10.3",
44
44
  "@embeddable.com/sdk-utils": "0.8.0",
45
45
  "@inquirer/prompts": "^7.2.1",
46
46
  "@stencil/core": "^4.23.0",
@@ -69,7 +69,7 @@ async function buildThemeHook(ctx: ResolvedEmbeddableConfig) {
69
69
  }
70
70
 
71
71
  const repoThemeImport = repoThemeHookExists
72
- ? `import localThemeProvider from '${ctx.client.customizationFile}';`
72
+ ? `import localThemeProvider from '${ctx.client.customizationFile.replace(/\\/g, "/")}';`
73
73
  : "const localThemeProvider = () => {};";
74
74
 
75
75
  // Generate a temporary file that imports both library and repo theme
@@ -274,4 +274,71 @@ describe("buildGlobalHooks (Unit Tests)", () => {
274
274
  }),
275
275
  );
276
276
  });
277
+
278
+ it("should normalize Windows paths in theme import statements", async () => {
279
+ // Mock template content that has the placeholder for local theme import
280
+ const templateContent = `{{LIBRARY_THEME_IMPORTS}}
281
+ {{LOCAL_THEME_IMPORT}}
282
+ // rest of template`;
283
+
284
+ (fs.readFile as Mock)
285
+ .mockResolvedValueOnce(templateContent) // Template read
286
+ .mockResolvedValueOnce("file content"); // Temp file read for hash
287
+
288
+ (getContentHash as Mock).mockReturnValue("hash123");
289
+ (vite.build as Mock).mockResolvedValue(undefined);
290
+ (fs.writeFile as Mock).mockResolvedValue(undefined);
291
+ (fs.rm as Mock).mockResolvedValue(undefined);
292
+
293
+ // Simulate Windows-style path with backslashes
294
+ const windowsThemePath =
295
+ "C:\\work\\code\\embeddable-boilerplate\\embeddable.theme.ts";
296
+
297
+ vi.spyOn(fsSync, "existsSync").mockImplementation((p: any) => {
298
+ if (p === windowsThemePath) return true; // Theme file exists
299
+ if (p === lifecyclePath) return false; // No lifecycle
300
+ return false;
301
+ });
302
+
303
+ (getComponentLibraryConfig as Mock).mockReturnValue({
304
+ libraryName: "testLib",
305
+ });
306
+ (getGlobalHooksMeta as Mock).mockResolvedValue({
307
+ themeProvider: null, // No library theme
308
+ lifecycleHooks: [],
309
+ });
310
+
311
+ const ctx: ResolvedEmbeddableConfig = {
312
+ client: {
313
+ srcDir: path.resolve(process.cwd(), "fake", "src"),
314
+ buildDir: path.resolve(process.cwd(), "fake", "build"),
315
+ tmpDir: path.resolve(process.cwd(), "fake", "tmp"),
316
+ rootDir: path.resolve(process.cwd(), "fake", "root"),
317
+ lifecycleHooksFile: lifecyclePath,
318
+ customizationFile: windowsThemePath, // Windows path with backslashes
319
+ componentLibraries: [],
320
+ },
321
+ core: {
322
+ templatesDir: "/fake/templates",
323
+ },
324
+ } as any;
325
+
326
+ await buildGlobalHooks(ctx);
327
+
328
+ // Verify that the temporary file was written with normalized path
329
+ expect(fs.writeFile).toHaveBeenCalledWith(
330
+ expect.stringContaining("embeddableThemeHook.js"),
331
+ expect.stringContaining(
332
+ "C:/work/code/embeddable-boilerplate/embeddable.theme.ts",
333
+ ), // Forward slashes
334
+ "utf8",
335
+ );
336
+
337
+ // Verify that the content does NOT contain backslashes (which would break imports)
338
+ const writeFileCall = (fs.writeFile as Mock).mock.calls.find((call) =>
339
+ call[0].includes("embeddableThemeHook.js"),
340
+ );
341
+ expect(writeFileCall).toBeDefined();
342
+ expect(writeFileCall![1]).not.toContain("C:\\work\\code"); // Should not have backslashes
343
+ });
277
344
  });