flowdular 0.6.3 → 0.6.4
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/distribution.js +1 -1
- package/dist/index.js +51 -11
- package/package.json +2 -2
package/dist/distribution.js
CHANGED
|
@@ -2821,7 +2821,7 @@ async function validateInstalledModules(workspace) {
|
|
|
2821
2821
|
}
|
|
2822
2822
|
|
|
2823
2823
|
// src/sdk.ts
|
|
2824
|
-
var SDK_VERSION = "0.6.
|
|
2824
|
+
var SDK_VERSION = "0.6.4";
|
|
2825
2825
|
function npmPackage(specifier) {
|
|
2826
2826
|
return specifier.startsWith("@") ? specifier.split("/").slice(0, 2).join("/") : specifier.split("/")[0];
|
|
2827
2827
|
}
|
package/dist/index.js
CHANGED
|
@@ -7320,10 +7320,12 @@ async function translationIssues(moduleRoot, manifest2, projectLocales) {
|
|
|
7320
7320
|
for (const [key, path] of [...missing].sort(
|
|
7321
7321
|
([left], [right]) => left.localeCompare(right)
|
|
7322
7322
|
)) {
|
|
7323
|
+
const localKey = key.slice(prefix.length);
|
|
7324
|
+
const prefixed = referenceKeys.has(key) ? ` The bundle has "${key}", but bundle keys leave out the "${prefix}" prefix.` : "";
|
|
7323
7325
|
issues.push(
|
|
7324
7326
|
issue(
|
|
7325
7327
|
"TRANSLATION_KEY_MISSING",
|
|
7326
|
-
`Translation key "${
|
|
7328
|
+
`Translation key "${localKey}" is missing from translations/${reference[0]}.json; the client reads it as t('${key}').${prefixed}`,
|
|
7327
7329
|
path
|
|
7328
7330
|
)
|
|
7329
7331
|
);
|
|
@@ -8966,7 +8968,7 @@ async function applyModulePlan(workspace, id, apply) {
|
|
|
8966
8968
|
import { readFile as readFile10 } from "node:fs/promises";
|
|
8967
8969
|
|
|
8968
8970
|
// src/sdk.ts
|
|
8969
|
-
var SDK_VERSION = "0.6.
|
|
8971
|
+
var SDK_VERSION = "0.6.4";
|
|
8970
8972
|
var LIBRARIES = /* @__PURE__ */ new Set([
|
|
8971
8973
|
"ai-provider",
|
|
8972
8974
|
"cli-protocol",
|
|
@@ -12883,6 +12885,7 @@ async function migrationVerify(workspace) {
|
|
|
12883
12885
|
// src/module-scaffold.ts
|
|
12884
12886
|
import {
|
|
12885
12887
|
access as access6,
|
|
12888
|
+
lstat as lstat6,
|
|
12886
12889
|
mkdir as mkdir10,
|
|
12887
12890
|
readdir as readdir8,
|
|
12888
12891
|
readFile as readFile19,
|
|
@@ -12937,11 +12940,44 @@ async function inspectTarget(workspaceRoot, moduleDirectory, specPath, specSourc
|
|
|
12937
12940
|
}
|
|
12938
12941
|
return { exists: true, present };
|
|
12939
12942
|
}
|
|
12940
|
-
|
|
12943
|
+
function jsonObject(source) {
|
|
12944
|
+
try {
|
|
12945
|
+
const value = JSON.parse(source);
|
|
12946
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
12947
|
+
} catch {
|
|
12948
|
+
return null;
|
|
12949
|
+
}
|
|
12950
|
+
}
|
|
12951
|
+
async function mergeAuthorBundles(moduleDirectory, planned, target) {
|
|
12952
|
+
const merged = /* @__PURE__ */ new Map();
|
|
12953
|
+
for (const [path, source] of planned) {
|
|
12954
|
+
if (!target.present.has(path) || !/^translations\/[^/]+\.json$/.test(path))
|
|
12955
|
+
continue;
|
|
12956
|
+
const file = join17(moduleDirectory, path);
|
|
12957
|
+
if (!(await lstat6(file)).isFile()) continue;
|
|
12958
|
+
const authored = jsonObject(await readFile19(file, "utf8"));
|
|
12959
|
+
const generated = jsonObject(source);
|
|
12960
|
+
if (authored && generated)
|
|
12961
|
+
merged.set(
|
|
12962
|
+
path,
|
|
12963
|
+
`${JSON.stringify({ ...generated, ...authored }, null, " ")}
|
|
12964
|
+
`
|
|
12965
|
+
);
|
|
12966
|
+
}
|
|
12967
|
+
return merged;
|
|
12968
|
+
}
|
|
12969
|
+
async function writeScaffold(moduleDirectory, files, target, merged) {
|
|
12941
12970
|
const written = [];
|
|
12942
12971
|
const createdDirectories = [];
|
|
12972
|
+
const replaced = /* @__PURE__ */ new Map();
|
|
12943
12973
|
try {
|
|
12944
12974
|
for (const [path, source] of files) {
|
|
12975
|
+
if (merged.has(path)) {
|
|
12976
|
+
const absolute2 = join17(moduleDirectory, path);
|
|
12977
|
+
replaced.set(absolute2, await readFile19(absolute2));
|
|
12978
|
+
await writeFile10(absolute2, source, "utf8");
|
|
12979
|
+
continue;
|
|
12980
|
+
}
|
|
12945
12981
|
if (target.present.has(path)) continue;
|
|
12946
12982
|
const absolute = join17(moduleDirectory, path);
|
|
12947
12983
|
const created = await mkdir10(dirname14(absolute), { recursive: true });
|
|
@@ -12953,6 +12989,7 @@ async function writeScaffold(moduleDirectory, files, target) {
|
|
|
12953
12989
|
if (!target.exists) {
|
|
12954
12990
|
await rm9(moduleDirectory, { recursive: true, force: true });
|
|
12955
12991
|
} else {
|
|
12992
|
+
for (const [file, source] of replaced) await writeFile10(file, source);
|
|
12956
12993
|
for (const file of written) await rm9(file, { force: true });
|
|
12957
12994
|
for (const directory of createdDirectories.reverse()) {
|
|
12958
12995
|
await rm9(directory, { recursive: true, force: true });
|
|
@@ -13008,12 +13045,14 @@ async function scaffoldModule(workspace, request) {
|
|
|
13008
13045
|
);
|
|
13009
13046
|
let planned = planScaffold(spec, specSource);
|
|
13010
13047
|
if ((await sdkModules(workspace)).size) planned = sdkScaffold(planned);
|
|
13048
|
+
const merged = await mergeAuthorBundles(moduleDirectory, planned, target);
|
|
13049
|
+
planned = new Map([...planned, ...merged]);
|
|
13011
13050
|
let formatted = false;
|
|
13012
13051
|
if (request.apply) {
|
|
13013
13052
|
const formatter = await loadWorkspaceFormatter(workspace.root);
|
|
13014
13053
|
const files = formatter ? await formatFiles(moduleDirectory, planned, formatter) : planned;
|
|
13015
13054
|
formatted = formatter !== null;
|
|
13016
|
-
await writeScaffold(moduleDirectory, files, target);
|
|
13055
|
+
await writeScaffold(moduleDirectory, files, target, new Set(merged.keys()));
|
|
13017
13056
|
}
|
|
13018
13057
|
const moduleRelative = relative11(workspace.root, moduleDirectory);
|
|
13019
13058
|
return {
|
|
@@ -13021,7 +13060,8 @@ async function scaffoldModule(workspace, request) {
|
|
|
13021
13060
|
formatted,
|
|
13022
13061
|
moduleDirectory: moduleRelative,
|
|
13023
13062
|
files: [...planned.keys()].map((path) => join17(moduleRelative, path)),
|
|
13024
|
-
skipped: [...planned.keys()].filter((path) => target.present.has(path)).map((path) => join17(moduleRelative, path))
|
|
13063
|
+
skipped: [...planned.keys()].filter((path) => target.present.has(path) && !merged.has(path)).map((path) => join17(moduleRelative, path)),
|
|
13064
|
+
merged: [...merged.keys()].map((path) => join17(moduleRelative, path))
|
|
13025
13065
|
};
|
|
13026
13066
|
}
|
|
13027
13067
|
async function formatFiles(moduleDirectory, files, formatter) {
|
|
@@ -13040,7 +13080,7 @@ import { constants as constants2 } from "node:fs";
|
|
|
13040
13080
|
import {
|
|
13041
13081
|
chmod as chmod3,
|
|
13042
13082
|
copyFile as copyFile2,
|
|
13043
|
-
lstat as
|
|
13083
|
+
lstat as lstat7,
|
|
13044
13084
|
mkdir as mkdir11,
|
|
13045
13085
|
readdir as readdir9,
|
|
13046
13086
|
readFile as readFile20,
|
|
@@ -13062,7 +13102,7 @@ function isMissing(error) {
|
|
|
13062
13102
|
}
|
|
13063
13103
|
async function pathState(path) {
|
|
13064
13104
|
try {
|
|
13065
|
-
return await
|
|
13105
|
+
return await lstat7(path);
|
|
13066
13106
|
} catch (error) {
|
|
13067
13107
|
if (isMissing(error)) return void 0;
|
|
13068
13108
|
throw error;
|
|
@@ -13148,7 +13188,7 @@ async function ensurePrivateDirectory(path) {
|
|
|
13148
13188
|
if (!(error instanceof Error && "code" in error && error.code === "EEXIST"))
|
|
13149
13189
|
throw error;
|
|
13150
13190
|
}
|
|
13151
|
-
const state = await
|
|
13191
|
+
const state = await lstat7(path);
|
|
13152
13192
|
if (state.isSymbolicLink() || !state.isDirectory()) {
|
|
13153
13193
|
throw new Error(`${path} is not a safe local state directory.`);
|
|
13154
13194
|
}
|
|
@@ -13160,7 +13200,7 @@ async function copyPlan(plan) {
|
|
|
13160
13200
|
const created = [];
|
|
13161
13201
|
try {
|
|
13162
13202
|
for (const file of plan.files) {
|
|
13163
|
-
const sourceState = await
|
|
13203
|
+
const sourceState = await lstat7(file.source);
|
|
13164
13204
|
if (sourceState.isSymbolicLink() || !sourceState.isFile()) {
|
|
13165
13205
|
throw new Error(`${file.name} is no longer a regular file.`);
|
|
13166
13206
|
}
|
|
@@ -14299,7 +14339,7 @@ import { stat as stat4 } from "node:fs/promises";
|
|
|
14299
14339
|
|
|
14300
14340
|
// src/setup-environment.ts
|
|
14301
14341
|
import { randomUUID as randomUUID6 } from "node:crypto";
|
|
14302
|
-
import { lstat as
|
|
14342
|
+
import { lstat as lstat8, open as open3, readFile as readFile23, rename as rename7, rm as rm11, writeFile as writeFile12 } from "node:fs/promises";
|
|
14303
14343
|
import { join as join21 } from "node:path";
|
|
14304
14344
|
async function readSetupEnvironment(root) {
|
|
14305
14345
|
try {
|
|
@@ -14312,7 +14352,7 @@ async function readSetupEnvironment(root) {
|
|
|
14312
14352
|
async function saveSetupEnvironment(root, before, updates) {
|
|
14313
14353
|
const path = join21(root, ".env");
|
|
14314
14354
|
try {
|
|
14315
|
-
if (!(await
|
|
14355
|
+
if (!(await lstat8(path)).isFile())
|
|
14316
14356
|
throw new Error("Setup requires .env to be a regular file.");
|
|
14317
14357
|
} catch (error) {
|
|
14318
14358
|
if (error.code !== "ENOENT") throw error;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "flowdular",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"flowdular": "./dist/index.js",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"ajv": "8.20.0",
|
|
17
17
|
"pg": "8.23.0",
|
|
18
18
|
"yaml": "2.9.0",
|
|
19
|
-
"@flowdular/sdk": "0.6.
|
|
19
|
+
"@flowdular/sdk": "0.6.4"
|
|
20
20
|
},
|
|
21
21
|
"license": "MIT",
|
|
22
22
|
"repository": {
|