@cloudcannon/editable-regions 0.0.20 → 0.0.21

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.
@@ -368,9 +368,10 @@ async function generateLiveEditingSource(
368
368
 
369
369
  for (const [i, filePath] of allLiquidFiles.entries()) {
370
370
  const id = `liquidFile_${i}`;
371
- source += `import ${id} from "./${filePath}";
371
+ const importPath = toPosixPath(filePath);
372
+ source += `import ${id} from ${JSON.stringify(`./${importPath}`)};
372
373
 
373
- window.cc_liquid_files["${filePath}"] = ${id};
374
+ window.cc_liquid_files[${JSON.stringify(importPath)}] = ${id};
374
375
  `;
375
376
  }
376
377
 
@@ -537,6 +538,14 @@ async function findAllLiquidFiles(
537
538
  return allFiles;
538
539
  }
539
540
 
541
+ /**
542
+ * @param {string} filePath
543
+ * @returns {string}
544
+ */
545
+ function toPosixPath(filePath) {
546
+ return filePath.split(path.sep).join("/");
547
+ }
548
+
540
549
  /**
541
550
  * @param {Object} options
542
551
  * @param {string} options.directory
@@ -625,7 +634,8 @@ function emitImportRegistrations(liquidOptions) {
625
634
  liquidOptions?.[optionKey] ?? {},
626
635
  ).entries()) {
627
636
  const id = `${optionKey}_${i}`;
628
- imports += `\nimport ${id} from "./${file}";\n`;
637
+ const importPath = toPosixPath(String(file));
638
+ imports += `\nimport ${id} from ${JSON.stringify(`./${importPath}`)};\n`;
629
639
  body += `${registerFn}(${JSON.stringify(name)}, ${id});\n`;
630
640
  }
631
641
  }
@@ -334,7 +334,9 @@ func (builder *editorSiteBuilder) targetPage(target string) page.Page {
334
334
  if f == nil {
335
335
  continue
336
336
  }
337
- if filepath.Join(builder.Cfg.Base.ContentDir, f.Path()) != target {
337
+ // `target` is slash-normalized; `filepath.Join` uses the OS
338
+ // separator, so normalize it too or Windows never matches.
339
+ if filepath.ToSlash(filepath.Join(builder.Cfg.Base.ContentDir, f.Path())) != target {
338
340
  continue
339
341
  }
340
342
  return p
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudcannon/editable-regions",
3
- "version": "0.0.20",
3
+ "version": "0.0.21",
4
4
  "type": "module",
5
5
  "description": "Visual Editing for the CloudCannon CMS.",
6
6
  "keywords": [
@@ -37,7 +37,8 @@
37
37
  "test:build-astro-fixture": "npm --prefix test/unit/_fixtures/astro install --silent && npm --prefix test/unit/_fixtures/astro run build",
38
38
  "test:build-eleventy-fixture": "npm --prefix test/unit/_fixtures/eleventy install --silent && npm --prefix test/unit/_fixtures/eleventy run build",
39
39
  "test:build-eleventy-plugin-config": "npm --prefix test/unit/_fixtures/eleventy-plugin-config install --silent && npm --prefix test/unit/_fixtures/eleventy-plugin-config run build",
40
- "test:build-hugo-fixture": "npm --prefix test/unit/_fixtures/hugo run build"
40
+ "test:build-hugo-fixture": "npm --prefix test/unit/_fixtures/hugo run build",
41
+ "test:integration": "npm run build:hugo && bash run-integration-tests.sh"
41
42
  },
42
43
  "files": [
43
44
  "components",
@@ -115,7 +116,7 @@
115
116
  "@types/node": "26.5.1",
116
117
  "@types/react": "19.3.0",
117
118
  "@types/react-dom": "19.3.0",
118
- "@vitejs/plugin-vue": "6.0.8",
119
+ "@vitejs/plugin-vue": "6.0.9",
119
120
  "astro": "7.3.2",
120
121
  "happy-dom": "20.14.5",
121
122
  "js-beautify": "2.0.3",