@mndw/cli 0.1.1 → 0.1.2

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/dist/meta.json CHANGED
@@ -346,7 +346,7 @@
346
346
  "format": "esm"
347
347
  },
348
348
  "src/create.ts": {
349
- "bytes": 20551,
349
+ "bytes": 20706,
350
350
  "imports": [
351
351
  {
352
352
  "path": "node:child_process",
@@ -746,7 +746,7 @@
746
746
  "format": "esm"
747
747
  },
748
748
  "src/dev-server/prebuilt-host.ts": {
749
- "bytes": 3693,
749
+ "bytes": 4310,
750
750
  "imports": [
751
751
  {
752
752
  "path": "node:fs",
@@ -762,7 +762,7 @@
762
762
  "format": "esm"
763
763
  },
764
764
  "src/dev-server/shared-externals.ts": {
765
- "bytes": 1231,
765
+ "bytes": 1326,
766
766
  "imports": [
767
767
  {
768
768
  "path": "../../frontend/sdk-internal/src/shared-dependencies.ts",
@@ -1710,7 +1710,7 @@
1710
1710
  "bytesInOutput": 31
1711
1711
  },
1712
1712
  "src/create.ts": {
1713
- "bytesInOutput": 14399
1713
+ "bytesInOutput": 14554
1714
1714
  },
1715
1715
  "src/errors.ts": {
1716
1716
  "bytesInOutput": 40
@@ -1785,7 +1785,7 @@
1785
1785
  "bytesInOutput": 1028
1786
1786
  },
1787
1787
  "src/dev-server/prebuilt-host.ts": {
1788
- "bytesInOutput": 3417
1788
+ "bytesInOutput": 3893
1789
1789
  },
1790
1790
  "src/dev-server/shared-externals.ts": {
1791
1791
  "bytesInOutput": 822
@@ -1815,7 +1815,7 @@
1815
1815
  "bytesInOutput": 1982
1816
1816
  }
1817
1817
  },
1818
- "bytes": 142027
1818
+ "bytes": 142658
1819
1819
  }
1820
1820
  }
1821
1821
  }
package/dist/mndw.js CHANGED
@@ -600,7 +600,7 @@ var SHARED_DEPENDENCIES = [
600
600
  {
601
601
  specifiers: ["@mndw/ui"],
602
602
  bundle: "mndw-ui",
603
- version: "0.1.1",
603
+ version: "0.1.2",
604
604
  entryPoint: "@mndw/ui",
605
605
  external: ["d3"],
606
606
  framework: "base"
@@ -904,6 +904,12 @@ function buildManifest(options) {
904
904
  } else {
905
905
  manifest.route = normalized.route;
906
906
  }
907
+ if (normalized.backend !== "go") {
908
+ manifest.i18n = {
909
+ defaultLocale: "en",
910
+ locales: { en: "i18n/en.json", ru: "i18n/ru.json" }
911
+ };
912
+ }
907
913
  if (normalized.backend === "go") {
908
914
  manifest.backend = {
909
915
  kind: "service",
@@ -2602,6 +2608,7 @@ var CONTENT_TYPES = {
2602
2608
  ".svg": "image/svg+xml",
2603
2609
  ".woff2": "font/woff2"
2604
2610
  };
2611
+ var LOOPBACK_ORIGIN = /^https?:\/\/(?:(?:[^:]+\.)?localhost|127\.0\.0\.1|\[::1\])(?::\d+)?$/i;
2605
2612
  function isWithin(root, path3) {
2606
2613
  const rel = relative4(root, path3);
2607
2614
  return rel === "" || !rel.startsWith(`..${sep2}`) && rel !== "..";
@@ -2613,6 +2620,18 @@ function existingFile(path3) {
2613
2620
  return false;
2614
2621
  }
2615
2622
  }
2623
+ function addLoopbackCorsHeaders(request, response) {
2624
+ const origin = request.headers.origin;
2625
+ response.setHeader("Vary", "Origin");
2626
+ if (typeof origin === "string" && LOOPBACK_ORIGIN.test(origin)) {
2627
+ response.setHeader("Access-Control-Allow-Origin", origin);
2628
+ }
2629
+ }
2630
+ function sendStaticFile(path3, response) {
2631
+ response.statusCode = 200;
2632
+ response.setHeader("Content-Type", CONTENT_TYPES[extname2(path3)] ?? "application/octet-stream");
2633
+ createReadStream(path3).pipe(response);
2634
+ }
2616
2635
  function prebuiltHost(dir) {
2617
2636
  const hostRoot = resolve12(dir);
2618
2637
  return {
@@ -2644,10 +2663,9 @@ function prebuiltHost(dir) {
2644
2663
  return;
2645
2664
  }
2646
2665
  if (pathname.startsWith("/assets/") || pathname.startsWith("/shared/")) {
2666
+ addLoopbackCorsHeaders(request, response);
2647
2667
  if (existingFile(hostPath)) {
2648
- response.statusCode = 200;
2649
- response.setHeader("Content-Type", CONTENT_TYPES[extname2(hostPath)] ?? "application/octet-stream");
2650
- createReadStream(hostPath).pipe(response);
2668
+ sendStaticFile(hostPath, response);
2651
2669
  return;
2652
2670
  }
2653
2671
  next();