livelocale 0.9.0 → 0.10.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.
@@ -5,8 +5,8 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <meta name="robots" content="noindex, nofollow" />
7
7
  <title>LiveLocale · Studio</title>
8
- <script type="module" crossorigin src="./assets/index-DC_jRsox.js"></script>
9
- <link rel="stylesheet" crossorigin href="./assets/index-Bvbtkry-.css">
8
+ <script type="module" crossorigin src="./assets/index-yI6iF4xN.js"></script>
9
+ <link rel="stylesheet" crossorigin href="./assets/index-FFC_lDHv.css">
10
10
  </head>
11
11
  <body class="bg-background text-foreground antialiased overflow-hidden">
12
12
  <div id="root"></div>
@@ -1581,7 +1581,7 @@ var BodyTooLargeError = class extends Error {
1581
1581
  }
1582
1582
  };
1583
1583
  function readNodeBody(req, maxBytes) {
1584
- return new Promise((resolve8, reject2) => {
1584
+ return new Promise((resolve9, reject2) => {
1585
1585
  let bodyText = "";
1586
1586
  let settled = false;
1587
1587
  req.on("data", (chunk) => {
@@ -1596,7 +1596,7 @@ function readNodeBody(req, maxBytes) {
1596
1596
  req.on("end", () => {
1597
1597
  if (settled) return;
1598
1598
  settled = true;
1599
- resolve8(bodyText);
1599
+ resolve9(bodyText);
1600
1600
  });
1601
1601
  req.on("error", (err) => {
1602
1602
  if (settled) return;
@@ -1622,7 +1622,7 @@ function deepMerge(target, source) {
1622
1622
  }
1623
1623
 
1624
1624
  // src/server/pack.ts
1625
- var import_fs5 = require("fs");
1625
+ var import_fs6 = require("fs");
1626
1626
  var path8 = __toESM(require("path"), 1);
1627
1627
 
1628
1628
  // src/core/flag-script.ts
@@ -1675,16 +1675,16 @@ var SHARE_MANIFEST_FORMAT = 1;
1675
1675
  var import_child_process2 = require("child_process");
1676
1676
  var import_fs3 = require("fs");
1677
1677
  var path5 = __toESM(require("path"), 1);
1678
- var runGit = (args, cwd) => new Promise((resolve8) => {
1678
+ var runGit = (args, cwd) => new Promise((resolve9) => {
1679
1679
  try {
1680
1680
  (0, import_child_process2.execFile)(
1681
1681
  "git",
1682
1682
  args,
1683
1683
  { cwd, windowsHide: true, env: { ...process.env, GIT_TERMINAL_PROMPT: "0" } },
1684
- (error, stdout) => resolve8(error ? null : String(stdout).trim())
1684
+ (error, stdout) => resolve9(error ? null : String(stdout).trim())
1685
1685
  );
1686
1686
  } catch {
1687
- resolve8(null);
1687
+ resolve9(null);
1688
1688
  }
1689
1689
  });
1690
1690
  var SHA_RE = /^[0-9a-f]{40}([0-9a-f]{24})?$/i;
@@ -1883,6 +1883,7 @@ function detectBuildTarget(projectDir) {
1883
1883
  }
1884
1884
 
1885
1885
  // src/server/module-dir.ts
1886
+ var import_fs5 = require("fs");
1886
1887
  var path7 = __toESM(require("path"), 1);
1887
1888
  var import_url = require("url");
1888
1889
  var import_meta = {};
@@ -1990,7 +1991,7 @@ async function readJsonObject(file, projectDir) {
1990
1991
  const shown = toPosix(path8.relative(projectDir, file));
1991
1992
  let parsed;
1992
1993
  try {
1993
- parsed = JSON.parse(await import_fs5.promises.readFile(file, "utf-8"));
1994
+ parsed = JSON.parse(await import_fs6.promises.readFile(file, "utf-8"));
1994
1995
  } catch (error) {
1995
1996
  throw new PackError(
1996
1997
  "INVALID_LOCALE_FILE",
@@ -2012,8 +2013,8 @@ async function collectShareData(options) {
2012
2013
  const warnings = [];
2013
2014
  let entries;
2014
2015
  try {
2015
- if (!(await import_fs5.promises.stat(localesDir)).isDirectory()) throw new Error("not a directory");
2016
- entries = await import_fs5.promises.readdir(localesDir, { withFileTypes: true });
2016
+ if (!(await import_fs6.promises.stat(localesDir)).isDirectory()) throw new Error("not a directory");
2017
+ entries = await import_fs6.promises.readdir(localesDir, { withFileTypes: true });
2017
2018
  } catch {
2018
2019
  throw new PackError(
2019
2020
  "LOCALES_NOT_FOUND",
@@ -2051,7 +2052,7 @@ async function collectShareData(options) {
2051
2052
  if (dirLocales.has(locale)) {
2052
2053
  dictionary = {};
2053
2054
  const folder = path8.join(localesDir, locale);
2054
- const files = (await import_fs5.promises.readdir(folder, { withFileTypes: true })).filter((file) => file.isFile() && file.name.endsWith(".json")).map((file) => file.name).sort();
2055
+ const files = (await import_fs6.promises.readdir(folder, { withFileTypes: true })).filter((file) => file.isFile() && file.name.endsWith(".json")).map((file) => file.name).sort();
2055
2056
  for (const file of files) {
2056
2057
  const namespace = file.slice(0, -".json".length);
2057
2058
  defineOwn(dictionary, namespace, await readJsonObject(path8.join(folder, file), projectDir));
@@ -2092,14 +2093,14 @@ function defaultStudioCandidates() {
2092
2093
  }
2093
2094
  function isDirectory(target) {
2094
2095
  try {
2095
- return (0, import_fs5.statSync)(target).isDirectory();
2096
+ return (0, import_fs6.statSync)(target).isDirectory();
2096
2097
  } catch {
2097
2098
  return false;
2098
2099
  }
2099
2100
  }
2100
2101
  function resolveStudioDir(candidates = defaultStudioCandidates()) {
2101
2102
  for (const dir of candidates) {
2102
- if ((0, import_fs5.existsSync)(path8.join(dir, "index.html")) && isDirectory(path8.join(dir, "assets"))) {
2103
+ if ((0, import_fs6.existsSync)(path8.join(dir, "index.html")) && isDirectory(path8.join(dir, "assets"))) {
2103
2104
  return dir;
2104
2105
  }
2105
2106
  }
@@ -2107,13 +2108,13 @@ function resolveStudioDir(candidates = defaultStudioCandidates()) {
2107
2108
  }
2108
2109
  async function ownsShareDir(shareDir) {
2109
2110
  try {
2110
- await import_fs5.promises.lstat(shareDir);
2111
+ await import_fs6.promises.lstat(shareDir);
2111
2112
  } catch {
2112
2113
  return true;
2113
2114
  }
2114
2115
  try {
2115
2116
  const manifest = JSON.parse(
2116
- await import_fs5.promises.readFile(path8.join(shareDir, SHARE_MANIFEST_FILE), "utf-8")
2117
+ await import_fs6.promises.readFile(path8.join(shareDir, SHARE_MANIFEST_FILE), "utf-8")
2117
2118
  );
2118
2119
  return isPlainObject(manifest) && typeof manifest["format"] === "number";
2119
2120
  } catch {
@@ -2123,7 +2124,7 @@ async function ownsShareDir(shareDir) {
2123
2124
  async function findHtmlFiles(outDir, shareDir) {
2124
2125
  const found = [];
2125
2126
  const walk = async (dir) => {
2126
- for (const entry of await import_fs5.promises.readdir(dir, { withFileTypes: true })) {
2127
+ for (const entry of await import_fs6.promises.readdir(dir, { withFileTypes: true })) {
2127
2128
  if (entry.isSymbolicLink()) continue;
2128
2129
  const full = path8.join(dir, entry.name);
2129
2130
  if (entry.isDirectory()) {
@@ -2170,30 +2171,30 @@ async function packOutput(options) {
2170
2171
  `${toPosix(path8.relative(projectDir, outDir))}/${SHARE_DIR}/ already exists and was not written by LiveLocale. Move it away and run again.`
2171
2172
  );
2172
2173
  }
2173
- await import_fs5.promises.rm(shareDir, { recursive: true, force: true });
2174
- await import_fs5.promises.cp(studioDir, shareDir, { recursive: true });
2175
- await import_fs5.promises.writeFile(
2174
+ await import_fs6.promises.rm(shareDir, { recursive: true, force: true });
2175
+ await import_fs6.promises.cp(studioDir, shareDir, { recursive: true });
2176
+ await import_fs6.promises.writeFile(
2176
2177
  path8.join(shareDir, SHARE_MANIFEST_FILE),
2177
2178
  JSON.stringify(data.manifest, null, 2) + "\n",
2178
2179
  "utf-8"
2179
2180
  );
2180
2181
  const localesDir = path8.join(shareDir, SHARE_LOCALES_DIR);
2181
- await import_fs5.promises.mkdir(localesDir, { recursive: true });
2182
+ await import_fs6.promises.mkdir(localesDir, { recursive: true });
2182
2183
  for (const locale of data.manifest.locales) {
2183
- await import_fs5.promises.writeFile(
2184
+ await import_fs6.promises.writeFile(
2184
2185
  path8.join(localesDir, `${locale}.json`),
2185
2186
  JSON.stringify(data.dictionaries[locale]),
2186
2187
  "utf-8"
2187
2188
  );
2188
2189
  }
2189
- await import_fs5.promises.writeFile(path8.join(shareDir, SHARE_FLAG_FILE), FLAG_SCRIPT, "utf-8");
2190
- const inject = injectHtml === "auto" ? target.kind !== "next" && !(0, import_fs5.existsSync)(path8.join(outDir, "_next")) : injectHtml;
2190
+ await import_fs6.promises.writeFile(path8.join(shareDir, SHARE_FLAG_FILE), FLAG_SCRIPT, "utf-8");
2191
+ const inject = injectHtml === "auto" ? target.kind !== "next" && !(0, import_fs6.existsSync)(path8.join(outDir, "_next")) : injectHtml;
2191
2192
  const htmlInjected = inject ? await findHtmlFiles(outDir, shareDir) : [];
2192
2193
  for (const rel of htmlInjected) {
2193
2194
  const file = path8.join(outDir, ...rel.split("/"));
2194
- const html = await import_fs5.promises.readFile(file, "utf-8");
2195
+ const html = await import_fs6.promises.readFile(file, "utf-8");
2195
2196
  const injected = injectFlagScript(html, flagSrcFor(base, rel));
2196
- if (injected !== html) await import_fs5.promises.writeFile(file, injected, "utf-8");
2197
+ if (injected !== html) await import_fs6.promises.writeFile(file, injected, "utf-8");
2197
2198
  }
2198
2199
  const warnings = [...data.warnings];
2199
2200
  if (base.kind === "relative") warnings.push(RELATIVE_BASE_WARNING);