@swarm.ing/pieui 2.0.29 → 2.0.31
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/cli.js +249 -97
- package/dist/code/args.d.ts.map +1 -1
- package/dist/code/commands/cardAddStory.d.ts.map +1 -1
- package/dist/code/commands/cardGeneratePreview.d.ts +4 -0
- package/dist/code/commands/cardGeneratePreview.d.ts.map +1 -0
- package/dist/code/types.d.ts +2 -1
- package/dist/code/types.d.ts.map +1 -1
- package/dist/storybook/addon/preset.d.cts +1 -0
- package/dist/storybook/addon/preset.d.cts.map +1 -1
- package/dist/storybook/addon/preset.js +18 -0
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -188157,7 +188157,7 @@ var require_typescript_json_schema = __commonJS((exports2) => {
|
|
|
188157
188157
|
});
|
|
188158
188158
|
|
|
188159
188159
|
// src/cli.ts
|
|
188160
|
-
var
|
|
188160
|
+
var import_node_path23 = __toESM(require("node:path"));
|
|
188161
188161
|
|
|
188162
188162
|
// src/code/args.ts
|
|
188163
188163
|
var VALID_CARD_ACTIONS = [
|
|
@@ -188171,7 +188171,8 @@ var VALID_CARD_ACTIONS = [
|
|
|
188171
188171
|
"remote",
|
|
188172
188172
|
"dump-metadata",
|
|
188173
188173
|
"check-sync",
|
|
188174
|
-
"add-story"
|
|
188174
|
+
"add-story",
|
|
188175
|
+
"generate-preview"
|
|
188175
188176
|
];
|
|
188176
188177
|
var VALID_CARD_REMOTE_ACTIONS = [
|
|
188177
188178
|
"push",
|
|
@@ -188375,6 +188376,9 @@ var parseArgs = (argv) => {
|
|
|
188375
188376
|
} else if (action === "add-story") {
|
|
188376
188377
|
result.componentName = positionals[0];
|
|
188377
188378
|
result.cardAddStoryForce = boolFlags.force;
|
|
188379
|
+
} else if (action === "generate-preview") {
|
|
188380
|
+
result.componentName = positionals[0];
|
|
188381
|
+
result.cardGeneratePreviewOut = flags.dumpMetadataOut;
|
|
188378
188382
|
} else if (action === "remote") {
|
|
188379
188383
|
const sub = positionals[0];
|
|
188380
188384
|
if (sub && VALID_CARD_REMOTE_ACTIONS.includes(sub)) {
|
|
@@ -188460,6 +188464,7 @@ var ALL_LINES = [
|
|
|
188460
188464
|
" card list-events <Name> List methods keys on the registered PieCard",
|
|
188461
188465
|
" card add-event <Name> <event> Add a new methods key with a default handler",
|
|
188462
188466
|
" card add-story <Name> [--force] Generate a Storybook stories.tsx wired to PieCard methods",
|
|
188467
|
+
" card generate-preview <Name> [--out file.png] Render the component story via storycap and save a PNG preview",
|
|
188463
188468
|
" card dump-metadata <Name> [--out file.json] Dump full PieMetadata JSON for the component",
|
|
188464
188469
|
" card check-sync <Name> Compare TS ↔ Python metadata; prompt for backend project path if not configured",
|
|
188465
188470
|
" card remote list [--user U] [--project S] List remote components",
|
|
@@ -188531,6 +188536,7 @@ var CARD_LINES = [
|
|
|
188531
188536
|
" list-events <Name> List methods keys on the registered PieCard",
|
|
188532
188537
|
" add-event <Name> <event> Add a new methods key with a default handler",
|
|
188533
188538
|
" add-story <Name> [--force] Generate a Storybook stories.tsx wired to PieCard methods (--force overwrites)",
|
|
188539
|
+
" generate-preview <Name> [--out file.png] Render the component story via storycap and save a PNG preview",
|
|
188534
188540
|
" dump-metadata <Name> [--out file.json] Dump full PieMetadata JSON for the component",
|
|
188535
188541
|
" check-sync <Name> Compare TS ↔ Python metadata; prompts for backend project path",
|
|
188536
188542
|
" remote ... Remote storage operations (see `pieui card remote --help`)",
|
|
@@ -196682,13 +196688,152 @@ var cardAddStoryCommand = (componentName, options = {}) => {
|
|
|
196682
196688
|
} else if (result.addedPerSite.length === 0) {
|
|
196683
196689
|
console.log(`[pieui] <PieCard> forwarding already complete in ${uiPath}`);
|
|
196684
196690
|
}
|
|
196691
|
+
const mainPath = findStorybookMainPath(process.cwd());
|
|
196692
|
+
if (!mainPath) {
|
|
196693
|
+
const bunBin = process.env.PIEUI_CREATE_BUN_BIN || "bun";
|
|
196694
|
+
installAndWireStorybook(process.cwd(), bunBin);
|
|
196695
|
+
} else {
|
|
196696
|
+
const addedAddon = patchStorybookMainAddons(mainPath);
|
|
196697
|
+
const addedStories = patchStorybookMainStories(mainPath);
|
|
196698
|
+
if (addedAddon) {
|
|
196699
|
+
console.log(`[pieui] Added '${PIEUI_STORYBOOK_ADDON}' to ${mainPath}`);
|
|
196700
|
+
}
|
|
196701
|
+
if (addedStories) {
|
|
196702
|
+
console.log(`[pieui] Added '${PIEUI_STORYBOOK_STORIES_GLOB}' to stories in ${mainPath}`);
|
|
196703
|
+
}
|
|
196704
|
+
if (!addedAddon && !addedStories) {
|
|
196705
|
+
console.log(`[pieui] Storybook config already wired (${import_node_path15.default.relative(process.cwd(), mainPath)})`);
|
|
196706
|
+
}
|
|
196707
|
+
}
|
|
196685
196708
|
printRequirements(cardAddStoryRequirements(componentName));
|
|
196686
196709
|
};
|
|
196687
196710
|
|
|
196688
|
-
// src/code/commands/
|
|
196711
|
+
// src/code/commands/cardGeneratePreview.ts
|
|
196689
196712
|
var import_node_fs15 = __toESM(require("node:fs"));
|
|
196713
|
+
var import_node_http = __toESM(require("node:http"));
|
|
196714
|
+
var import_node_os = __toESM(require("node:os"));
|
|
196690
196715
|
var import_node_path16 = __toESM(require("node:path"));
|
|
196691
196716
|
var import_node_child_process3 = require("node:child_process");
|
|
196717
|
+
var STORYBOOK_PORT = 6006;
|
|
196718
|
+
var STORY_TITLE_NAMESPACE = "PieComponents";
|
|
196719
|
+
var isStorybookReachable = (port) => new Promise((resolve) => {
|
|
196720
|
+
const req = import_node_http.default.get({ hostname: "localhost", port, path: "/index.json" }, (res) => {
|
|
196721
|
+
res.resume();
|
|
196722
|
+
resolve(res.statusCode === 200);
|
|
196723
|
+
});
|
|
196724
|
+
req.on("error", () => resolve(false));
|
|
196725
|
+
req.setTimeout(1500, () => {
|
|
196726
|
+
req.destroy();
|
|
196727
|
+
resolve(false);
|
|
196728
|
+
});
|
|
196729
|
+
});
|
|
196730
|
+
var waitForStorybook = async (port, timeoutMs) => {
|
|
196731
|
+
const deadline = Date.now() + timeoutMs;
|
|
196732
|
+
while (Date.now() < deadline) {
|
|
196733
|
+
if (await isStorybookReachable(port))
|
|
196734
|
+
return true;
|
|
196735
|
+
await new Promise((r) => setTimeout(r, 1500));
|
|
196736
|
+
}
|
|
196737
|
+
return false;
|
|
196738
|
+
};
|
|
196739
|
+
var killProcessTree = (proc) => {
|
|
196740
|
+
if (!proc.pid)
|
|
196741
|
+
return;
|
|
196742
|
+
try {
|
|
196743
|
+
process.kill(-proc.pid, "SIGTERM");
|
|
196744
|
+
} catch {
|
|
196745
|
+
try {
|
|
196746
|
+
proc.kill("SIGTERM");
|
|
196747
|
+
} catch {}
|
|
196748
|
+
}
|
|
196749
|
+
};
|
|
196750
|
+
var cardGeneratePreviewCommand = async (componentName, options = {}) => {
|
|
196751
|
+
if (!componentName) {
|
|
196752
|
+
throw new Error("Component name is required");
|
|
196753
|
+
}
|
|
196754
|
+
const settings = loadSettings();
|
|
196755
|
+
const componentDir = import_node_path16.default.join(settings.componentsDir, componentName);
|
|
196756
|
+
if (!import_node_fs15.default.existsSync(componentDir)) {
|
|
196757
|
+
throw new Error(`Component directory not found: ${componentDir}`);
|
|
196758
|
+
}
|
|
196759
|
+
const storyPath = import_node_path16.default.join(componentDir, `${componentName}.stories.tsx`);
|
|
196760
|
+
if (!import_node_fs15.default.existsSync(storyPath)) {
|
|
196761
|
+
throw new Error(`Story file not found: ${storyPath}
|
|
196762
|
+
` + `Run \`pieui card add-story ${componentName}\` first.`);
|
|
196763
|
+
}
|
|
196764
|
+
const outPath = import_node_path16.default.resolve(process.cwd(), options.out || import_node_path16.default.join(componentDir, "preview.png"));
|
|
196765
|
+
import_node_fs15.default.mkdirSync(import_node_path16.default.dirname(outPath), { recursive: true });
|
|
196766
|
+
const bunBin = process.env.PIEUI_CREATE_BUN_BIN || "bun";
|
|
196767
|
+
let sbProc = null;
|
|
196768
|
+
const alreadyRunning = await isStorybookReachable(STORYBOOK_PORT);
|
|
196769
|
+
if (!alreadyRunning) {
|
|
196770
|
+
console.log(`[pieui] Storybook not running on :${STORYBOOK_PORT} — starting it temporarily...`);
|
|
196771
|
+
sbProc = import_node_child_process3.spawn(bunBin, ["run", "storybook"], {
|
|
196772
|
+
cwd: process.cwd(),
|
|
196773
|
+
stdio: "ignore",
|
|
196774
|
+
env: process.env,
|
|
196775
|
+
detached: true
|
|
196776
|
+
});
|
|
196777
|
+
sbProc.unref();
|
|
196778
|
+
const ready = await waitForStorybook(STORYBOOK_PORT, 180000);
|
|
196779
|
+
if (!ready) {
|
|
196780
|
+
killProcessTree(sbProc);
|
|
196781
|
+
throw new Error("Storybook failed to become reachable within 3 minutes");
|
|
196782
|
+
}
|
|
196783
|
+
console.log(`[pieui] Storybook ready on :${STORYBOOK_PORT}`);
|
|
196784
|
+
} else {
|
|
196785
|
+
console.log(`[pieui] Using running Storybook on :${STORYBOOK_PORT}`);
|
|
196786
|
+
}
|
|
196787
|
+
const tmpDir = import_node_fs15.default.mkdtempSync(import_node_path16.default.join(import_node_os.default.tmpdir(), "pieui-storycap-"));
|
|
196788
|
+
try {
|
|
196789
|
+
const include = `${STORY_TITLE_NAMESPACE}/${componentName}/*`;
|
|
196790
|
+
console.log(`[pieui] Running storycap for "${include}"...`);
|
|
196791
|
+
const result = import_node_child_process3.spawnSync(bunBin, [
|
|
196792
|
+
"x",
|
|
196793
|
+
"storycap@latest",
|
|
196794
|
+
`http://localhost:${STORYBOOK_PORT}`,
|
|
196795
|
+
"--include",
|
|
196796
|
+
include,
|
|
196797
|
+
"--outDir",
|
|
196798
|
+
tmpDir,
|
|
196799
|
+
"--serverTimeout",
|
|
196800
|
+
"60000"
|
|
196801
|
+
], {
|
|
196802
|
+
cwd: process.cwd(),
|
|
196803
|
+
stdio: "inherit",
|
|
196804
|
+
env: process.env
|
|
196805
|
+
});
|
|
196806
|
+
if (result.error) {
|
|
196807
|
+
throw result.error;
|
|
196808
|
+
}
|
|
196809
|
+
if (result.status !== 0) {
|
|
196810
|
+
throw new Error(`storycap exited with code ${result.status ?? "unknown"}`);
|
|
196811
|
+
}
|
|
196812
|
+
const producedDir = import_node_path16.default.join(tmpDir, STORY_TITLE_NAMESPACE, componentName);
|
|
196813
|
+
if (!import_node_fs15.default.existsSync(producedDir)) {
|
|
196814
|
+
throw new Error(`storycap finished but no PNGs were produced under ${producedDir}
|
|
196815
|
+
` + `Tmp listing: ${import_node_fs15.default.readdirSync(tmpDir).join(", ") || "(empty)"}`);
|
|
196816
|
+
}
|
|
196817
|
+
const pngs = import_node_fs15.default.readdirSync(producedDir).filter((f) => f.endsWith(".png")).sort();
|
|
196818
|
+
if (pngs.length === 0) {
|
|
196819
|
+
throw new Error(`No PNGs in ${producedDir}`);
|
|
196820
|
+
}
|
|
196821
|
+
const picked = import_node_path16.default.join(producedDir, pngs[0]);
|
|
196822
|
+
import_node_fs15.default.copyFileSync(picked, outPath);
|
|
196823
|
+
console.log(`[pieui] Preview written: ${outPath}` + (pngs.length > 1 ? ` (picked ${pngs[0]}; other states available: ${pngs.slice(1).join(", ")})` : ""));
|
|
196824
|
+
} finally {
|
|
196825
|
+
import_node_fs15.default.rmSync(tmpDir, { recursive: true, force: true });
|
|
196826
|
+
if (sbProc) {
|
|
196827
|
+
killProcessTree(sbProc);
|
|
196828
|
+
console.log("[pieui] Storybook stopped");
|
|
196829
|
+
}
|
|
196830
|
+
}
|
|
196831
|
+
};
|
|
196832
|
+
|
|
196833
|
+
// src/code/commands/cardAddFromMeta.ts
|
|
196834
|
+
var import_node_fs16 = __toESM(require("node:fs"));
|
|
196835
|
+
var import_node_path17 = __toESM(require("node:path"));
|
|
196836
|
+
var import_node_child_process4 = require("node:child_process");
|
|
196692
196837
|
|
|
196693
196838
|
// src/code/jsonSchemaToTs.ts
|
|
196694
196839
|
var INDENT = " ";
|
|
@@ -196768,11 +196913,11 @@ var jsonSchemaToTsType = (schema) => renderType(asSchema(schema), 0);
|
|
|
196768
196913
|
// src/code/commands/cardAddFromMeta.ts
|
|
196769
196914
|
var PIE_CONFIG_PATH = ".pie/config.json";
|
|
196770
196915
|
var readBackendConfig = () => {
|
|
196771
|
-
const configPath =
|
|
196772
|
-
if (!
|
|
196916
|
+
const configPath = import_node_path17.default.join(process.cwd(), PIE_CONFIG_PATH);
|
|
196917
|
+
if (!import_node_fs16.default.existsSync(configPath))
|
|
196773
196918
|
return null;
|
|
196774
196919
|
try {
|
|
196775
|
-
const parsed = JSON.parse(
|
|
196920
|
+
const parsed = JSON.parse(import_node_fs16.default.readFileSync(configPath, "utf8"));
|
|
196776
196921
|
if (typeof parsed !== "object" || parsed === null)
|
|
196777
196922
|
return null;
|
|
196778
196923
|
return parsed;
|
|
@@ -196789,16 +196934,16 @@ var cardNameToClassFilename = (name) => {
|
|
|
196789
196934
|
return snake.endsWith("_card") ? `${snake}.py` : `${snake}_card.py`;
|
|
196790
196935
|
};
|
|
196791
196936
|
var resolveSource = (fromRaw, cardName, cfg) => {
|
|
196792
|
-
if (fromRaw &&
|
|
196793
|
-
const stat =
|
|
196794
|
-
const abs =
|
|
196937
|
+
if (fromRaw && import_node_fs16.default.existsSync(fromRaw)) {
|
|
196938
|
+
const stat = import_node_fs16.default.statSync(fromRaw);
|
|
196939
|
+
const abs = import_node_path17.default.resolve(fromRaw);
|
|
196795
196940
|
if (stat.isFile() && abs.endsWith(".json")) {
|
|
196796
196941
|
return { kind: "json-file", path: abs };
|
|
196797
196942
|
}
|
|
196798
196943
|
if (stat.isFile() && abs.endsWith(".py")) {
|
|
196799
|
-
const componentsDir2 =
|
|
196800
|
-
const backendRoot2 =
|
|
196801
|
-
const inferred = classFilenameToCardName(
|
|
196944
|
+
const componentsDir2 = import_node_path17.default.dirname(abs);
|
|
196945
|
+
const backendRoot2 = import_node_path17.default.dirname(componentsDir2);
|
|
196946
|
+
const inferred = classFilenameToCardName(import_node_path17.default.basename(abs));
|
|
196802
196947
|
return {
|
|
196803
196948
|
kind: "py-file",
|
|
196804
196949
|
backendRoot: backendRoot2,
|
|
@@ -196806,7 +196951,7 @@ var resolveSource = (fromRaw, cardName, cfg) => {
|
|
|
196806
196951
|
};
|
|
196807
196952
|
}
|
|
196808
196953
|
if (stat.isDirectory()) {
|
|
196809
|
-
const backendRoot2 =
|
|
196954
|
+
const backendRoot2 = import_node_path17.default.dirname(abs);
|
|
196810
196955
|
return { kind: "name", backendRoot: backendRoot2, cardName };
|
|
196811
196956
|
}
|
|
196812
196957
|
throw new Error(`--from path is not a recognized source: ${fromRaw}`);
|
|
@@ -196815,15 +196960,15 @@ var resolveSource = (fromRaw, cardName, cfg) => {
|
|
|
196815
196960
|
if (!cfg?.backendComponentsDir) {
|
|
196816
196961
|
throw new Error(`--from "${fromRaw}" is not an existing path and no backendComponentsDir is configured in ${PIE_CONFIG_PATH}`);
|
|
196817
196962
|
}
|
|
196818
|
-
const componentsDir2 =
|
|
196819
|
-
const backendRoot2 =
|
|
196963
|
+
const componentsDir2 = import_node_path17.default.resolve(cfg.backendComponentsDir);
|
|
196964
|
+
const backendRoot2 = import_node_path17.default.dirname(componentsDir2);
|
|
196820
196965
|
return { kind: "name", backendRoot: backendRoot2, cardName: fromRaw };
|
|
196821
196966
|
}
|
|
196822
196967
|
if (!cfg?.backendComponentsDir) {
|
|
196823
196968
|
throw new Error(`No --from provided and no backendComponentsDir configured in ${PIE_CONFIG_PATH}`);
|
|
196824
196969
|
}
|
|
196825
|
-
const componentsDir =
|
|
196826
|
-
const backendRoot =
|
|
196970
|
+
const componentsDir = import_node_path17.default.resolve(cfg.backendComponentsDir);
|
|
196971
|
+
const backendRoot = import_node_path17.default.dirname(componentsDir);
|
|
196827
196972
|
return { kind: "name", backendRoot, cardName };
|
|
196828
196973
|
};
|
|
196829
196974
|
var unwrapTypescriptEnvelope2 = (parsed) => {
|
|
@@ -196840,11 +196985,11 @@ var unwrapTypescriptEnvelope2 = (parsed) => {
|
|
|
196840
196985
|
};
|
|
196841
196986
|
var fetchMetadata = (source) => {
|
|
196842
196987
|
if (source.kind === "json-file") {
|
|
196843
|
-
const raw =
|
|
196988
|
+
const raw = import_node_fs16.default.readFileSync(source.path, "utf8");
|
|
196844
196989
|
return unwrapTypescriptEnvelope2(JSON.parse(raw));
|
|
196845
196990
|
}
|
|
196846
196991
|
console.log(`[pieui] Invoking: pie card dump-metadata ${source.cardName} (cwd: ${source.backendRoot})`);
|
|
196847
|
-
const result =
|
|
196992
|
+
const result = import_node_child_process4.spawnSync("pie", ["card", "dump-metadata", source.cardName], {
|
|
196848
196993
|
cwd: source.backendRoot,
|
|
196849
196994
|
stdio: ["ignore", "pipe", "pipe"],
|
|
196850
196995
|
env: process.env
|
|
@@ -196976,10 +197121,10 @@ var renderUI = (componentName, meta, inputInterfaceName) => {
|
|
|
196976
197121
|
};
|
|
196977
197122
|
var updateRegistryFile2 = (componentsDir, componentName) => {
|
|
196978
197123
|
const registryPath = resolveRegistryPath(componentsDir);
|
|
196979
|
-
if (!
|
|
197124
|
+
if (!import_node_fs16.default.existsSync(registryPath)) {
|
|
196980
197125
|
throw new Error('registry.ts not found. Run "pieui init" first.');
|
|
196981
197126
|
}
|
|
196982
|
-
let registryContent =
|
|
197127
|
+
let registryContent = import_node_fs16.default.readFileSync(registryPath, "utf8");
|
|
196983
197128
|
const importRegex = new RegExp(`["']@/piecomponents/${componentName}["']`);
|
|
196984
197129
|
if (importRegex.test(registryContent)) {
|
|
196985
197130
|
throw new Error(`Component ${componentName} is already registered in registry.ts`);
|
|
@@ -196988,17 +197133,17 @@ var updateRegistryFile2 = (componentsDir, componentName) => {
|
|
|
196988
197133
|
registryContent = registryContent.trimEnd() + `
|
|
196989
197134
|
` + importLine + `
|
|
196990
197135
|
`;
|
|
196991
|
-
|
|
197136
|
+
import_node_fs16.default.writeFileSync(registryPath, registryContent, "utf8");
|
|
196992
197137
|
};
|
|
196993
197138
|
var hasBackendSourceFor = (componentName) => {
|
|
196994
197139
|
const cfg = readBackendConfig();
|
|
196995
197140
|
if (!cfg?.backendComponentsDir)
|
|
196996
197141
|
return false;
|
|
196997
|
-
const componentsDir =
|
|
196998
|
-
if (!
|
|
197142
|
+
const componentsDir = import_node_path17.default.resolve(cfg.backendComponentsDir);
|
|
197143
|
+
if (!import_node_fs16.default.existsSync(componentsDir))
|
|
196999
197144
|
return false;
|
|
197000
|
-
const candidate =
|
|
197001
|
-
return
|
|
197145
|
+
const candidate = import_node_path17.default.join(componentsDir, cardNameToClassFilename(componentName));
|
|
197146
|
+
return import_node_fs16.default.existsSync(candidate);
|
|
197002
197147
|
};
|
|
197003
197148
|
var cardAddFromMetaCommand = (componentName, componentType, fromRaw) => {
|
|
197004
197149
|
if (!componentName) {
|
|
@@ -197010,8 +197155,8 @@ var cardAddFromMetaCommand = (componentName, componentType, fromRaw) => {
|
|
|
197010
197155
|
const cfg = readBackendConfig();
|
|
197011
197156
|
const source = resolveSource(fromRaw, componentName, cfg);
|
|
197012
197157
|
if (source.kind === "name") {
|
|
197013
|
-
const candidate =
|
|
197014
|
-
if (!
|
|
197158
|
+
const candidate = import_node_path17.default.join(source.backendRoot, import_node_path17.default.basename(import_node_path17.default.resolve(cfg.backendComponentsDir)), cardNameToClassFilename(source.cardName));
|
|
197159
|
+
if (!import_node_fs16.default.existsSync(candidate)) {
|
|
197015
197160
|
console.warn(`[pieui] Note: expected backend file ${candidate} not found; relying on pie's resolution`);
|
|
197016
197161
|
}
|
|
197017
197162
|
}
|
|
@@ -197019,30 +197164,30 @@ var cardAddFromMetaCommand = (componentName, componentType, fromRaw) => {
|
|
|
197019
197164
|
console.log(`[pieui] Loaded metadata for "${meta.name}" (${meta.events.length} events, input: ${meta.inputPropsCode ? "yes" : "no"})`);
|
|
197020
197165
|
const dataInterfaceName = extractTypeName(meta.propsCode) || `${componentName}Data`;
|
|
197021
197166
|
const inputInterfaceName = meta.inputPropsCode ? extractTypeName(meta.inputPropsCode) || `${componentName}StoredInput` : null;
|
|
197022
|
-
const pieComponentsDir =
|
|
197023
|
-
if (!
|
|
197167
|
+
const pieComponentsDir = import_node_path17.default.join(process.cwd(), "piecomponents");
|
|
197168
|
+
if (!import_node_fs16.default.existsSync(pieComponentsDir)) {
|
|
197024
197169
|
throw new Error('piecomponents directory not found. Run "pieui init" first.');
|
|
197025
197170
|
}
|
|
197026
|
-
const componentDir =
|
|
197027
|
-
if (
|
|
197171
|
+
const componentDir = import_node_path17.default.join(pieComponentsDir, componentName);
|
|
197172
|
+
if (import_node_fs16.default.existsSync(componentDir)) {
|
|
197028
197173
|
throw new Error(`Component ${componentName} already exists`);
|
|
197029
197174
|
}
|
|
197030
197175
|
try {
|
|
197031
|
-
|
|
197032
|
-
|
|
197033
|
-
|
|
197034
|
-
|
|
197035
|
-
|
|
197176
|
+
import_node_fs16.default.mkdirSync(import_node_path17.default.join(componentDir, "ui"), { recursive: true });
|
|
197177
|
+
import_node_fs16.default.mkdirSync(import_node_path17.default.join(componentDir, "types"), { recursive: true });
|
|
197178
|
+
import_node_fs16.default.writeFileSync(import_node_path17.default.join(componentDir, "index.ts"), componentIndexTemplate(componentName), "utf8");
|
|
197179
|
+
import_node_fs16.default.writeFileSync(import_node_path17.default.join(componentDir, "types", "index.ts"), renderTypes(componentName, componentType, meta, dataInterfaceName, inputInterfaceName), "utf8");
|
|
197180
|
+
import_node_fs16.default.writeFileSync(import_node_path17.default.join(componentDir, "ui", `${componentName}.tsx`), renderUI(componentName, meta, inputInterfaceName), "utf8");
|
|
197036
197181
|
updateRegistryFile2(pieComponentsDir, componentName);
|
|
197037
197182
|
} catch (error) {
|
|
197038
|
-
|
|
197183
|
+
import_node_fs16.default.rmSync(componentDir, { recursive: true, force: true });
|
|
197039
197184
|
throw error;
|
|
197040
197185
|
}
|
|
197041
197186
|
console.log(`[pieui] Component ${componentName} ported from backend successfully`);
|
|
197042
197187
|
console.log(`[pieui] Files created:`);
|
|
197043
|
-
console.log(` - ${
|
|
197044
|
-
console.log(` - ${
|
|
197045
|
-
console.log(` - ${
|
|
197188
|
+
console.log(` - ${import_node_path17.default.join(componentDir, "index.ts")}`);
|
|
197189
|
+
console.log(` - ${import_node_path17.default.join(componentDir, "types", "index.ts")}`);
|
|
197190
|
+
console.log(` - ${import_node_path17.default.join(componentDir, "ui", `${componentName}.tsx`)}`);
|
|
197046
197191
|
console.log(`[pieui] Data interface: ${dataInterfaceName}`);
|
|
197047
197192
|
if (inputInterfaceName) {
|
|
197048
197193
|
console.log(`[pieui] Input interface: ${inputInterfaceName}`);
|
|
@@ -197102,8 +197247,8 @@ var pageAddCommand = (pagePath) => {
|
|
|
197102
197247
|
};
|
|
197103
197248
|
|
|
197104
197249
|
// src/code/commands/pageView.ts
|
|
197105
|
-
var
|
|
197106
|
-
var
|
|
197250
|
+
var import_node_fs17 = __toESM(require("node:fs"));
|
|
197251
|
+
var import_node_path18 = __toESM(require("node:path"));
|
|
197107
197252
|
var normalizePagePath2 = (pagePath) => {
|
|
197108
197253
|
const trimmed = pagePath.trim();
|
|
197109
197254
|
if (!trimmed)
|
|
@@ -197112,7 +197257,7 @@ var normalizePagePath2 = (pagePath) => {
|
|
|
197112
197257
|
const noRel = slashed.replace(/^\.\/+/, "");
|
|
197113
197258
|
const noApp = noRel.replace(/^app\//, "");
|
|
197114
197259
|
const noEdge = noApp.replace(/^\/+|\/+$/g, "");
|
|
197115
|
-
const normalized =
|
|
197260
|
+
const normalized = import_node_path18.default.posix.normalize(noEdge);
|
|
197116
197261
|
if (!normalized || normalized === ".") {
|
|
197117
197262
|
throw new Error("Path is required for page view command");
|
|
197118
197263
|
}
|
|
@@ -197123,11 +197268,11 @@ var normalizePagePath2 = (pagePath) => {
|
|
|
197123
197268
|
};
|
|
197124
197269
|
var pageViewCommand = (pagePath) => {
|
|
197125
197270
|
const normalized = normalizePagePath2(pagePath);
|
|
197126
|
-
const target =
|
|
197127
|
-
if (!
|
|
197271
|
+
const target = import_node_path18.default.join(process.cwd(), "app", normalized, "page.tsx");
|
|
197272
|
+
if (!import_node_fs17.default.existsSync(target)) {
|
|
197128
197273
|
throw new Error(`Page file not found: ${target}`);
|
|
197129
197274
|
}
|
|
197130
|
-
const source =
|
|
197275
|
+
const source = import_node_fs17.default.readFileSync(target, "utf8");
|
|
197131
197276
|
console.log(`[pieui] Path: ${target}`);
|
|
197132
197277
|
console.log("");
|
|
197133
197278
|
process.stdout.write(source);
|
|
@@ -197137,26 +197282,26 @@ var pageViewCommand = (pagePath) => {
|
|
|
197137
197282
|
};
|
|
197138
197283
|
|
|
197139
197284
|
// src/code/commands/pageAjax.ts
|
|
197140
|
-
var
|
|
197141
|
-
var
|
|
197142
|
-
var
|
|
197285
|
+
var import_node_fs18 = __toESM(require("node:fs"));
|
|
197286
|
+
var import_node_path19 = __toESM(require("node:path"));
|
|
197287
|
+
var import_node_child_process5 = require("node:child_process");
|
|
197143
197288
|
var PIE_CONFIG_PATH2 = ".pie/config.json";
|
|
197144
197289
|
var readBackendRoot = () => {
|
|
197145
|
-
const configPath =
|
|
197146
|
-
if (!
|
|
197290
|
+
const configPath = import_node_path19.default.join(process.cwd(), PIE_CONFIG_PATH2);
|
|
197291
|
+
if (!import_node_fs18.default.existsSync(configPath))
|
|
197147
197292
|
return;
|
|
197148
197293
|
try {
|
|
197149
|
-
const parsed = JSON.parse(
|
|
197294
|
+
const parsed = JSON.parse(import_node_fs18.default.readFileSync(configPath, "utf8"));
|
|
197150
197295
|
if (typeof parsed !== "object" || parsed === null)
|
|
197151
197296
|
return;
|
|
197152
197297
|
const config = parsed;
|
|
197153
197298
|
if (!config.backendPagesDir)
|
|
197154
197299
|
return;
|
|
197155
|
-
const pages =
|
|
197156
|
-
if (!
|
|
197300
|
+
const pages = import_node_path19.default.resolve(config.backendPagesDir);
|
|
197301
|
+
if (!import_node_fs18.default.existsSync(pages) || !import_node_fs18.default.statSync(pages).isDirectory()) {
|
|
197157
197302
|
return;
|
|
197158
197303
|
}
|
|
197159
|
-
return
|
|
197304
|
+
return import_node_path19.default.dirname(pages);
|
|
197160
197305
|
} catch {
|
|
197161
197306
|
return;
|
|
197162
197307
|
}
|
|
@@ -197173,7 +197318,7 @@ var pageAjaxCommand = (pageName, action, handlerName) => {
|
|
|
197173
197318
|
}
|
|
197174
197319
|
console.log(`[pieui] Delegating to backend: ${backendRoot}`);
|
|
197175
197320
|
console.log(`[pieui] pie page ajax ${pageName} ${action} ${handlerName}`);
|
|
197176
|
-
const result =
|
|
197321
|
+
const result = import_node_child_process5.spawnSync("pie", ["page", "ajax", pageName, action, handlerName], { cwd: backendRoot, stdio: "inherit", env: process.env });
|
|
197177
197322
|
if (result.error) {
|
|
197178
197323
|
throw new Error(`Failed to invoke \`pie\` in ${backendRoot}: ${result.error.message}`);
|
|
197179
197324
|
}
|
|
@@ -197539,49 +197684,49 @@ var createPieAppCommand = (appName) => {
|
|
|
197539
197684
|
};
|
|
197540
197685
|
|
|
197541
197686
|
// src/code/commands/login.ts
|
|
197542
|
-
var
|
|
197687
|
+
var import_node_child_process6 = require("node:child_process");
|
|
197543
197688
|
var import_node_crypto = require("node:crypto");
|
|
197544
|
-
var
|
|
197545
|
-
var
|
|
197689
|
+
var import_node_fs20 = __toESM(require("node:fs"));
|
|
197690
|
+
var import_node_path21 = __toESM(require("node:path"));
|
|
197546
197691
|
|
|
197547
197692
|
// src/code/services/projectLinks.ts
|
|
197548
|
-
var
|
|
197549
|
-
var
|
|
197693
|
+
var import_node_fs19 = __toESM(require("node:fs"));
|
|
197694
|
+
var import_node_path20 = __toESM(require("node:path"));
|
|
197550
197695
|
var readline3 = __toESM(require("node:readline/promises"));
|
|
197551
197696
|
var PIE_CONFIG_DIR3 = ".pie";
|
|
197552
197697
|
var PIE_CONFIG_FILE3 = "config.json";
|
|
197553
|
-
var configPathFor = (cwd) =>
|
|
197698
|
+
var configPathFor = (cwd) => import_node_path20.default.join(cwd, PIE_CONFIG_DIR3, PIE_CONFIG_FILE3);
|
|
197554
197699
|
var readConfig2 = (cwd) => {
|
|
197555
197700
|
const p = configPathFor(cwd);
|
|
197556
|
-
if (!
|
|
197701
|
+
if (!import_node_fs19.default.existsSync(p))
|
|
197557
197702
|
return {};
|
|
197558
197703
|
try {
|
|
197559
|
-
const parsed = JSON.parse(
|
|
197704
|
+
const parsed = JSON.parse(import_node_fs19.default.readFileSync(p, "utf8"));
|
|
197560
197705
|
return typeof parsed === "object" && parsed !== null && !Array.isArray(parsed) ? parsed : {};
|
|
197561
197706
|
} catch {
|
|
197562
197707
|
return {};
|
|
197563
197708
|
}
|
|
197564
197709
|
};
|
|
197565
197710
|
var writeConfig2 = (cwd, config) => {
|
|
197566
|
-
const dir =
|
|
197567
|
-
|
|
197568
|
-
|
|
197711
|
+
const dir = import_node_path20.default.join(cwd, PIE_CONFIG_DIR3);
|
|
197712
|
+
import_node_fs19.default.mkdirSync(dir, { recursive: true });
|
|
197713
|
+
import_node_fs19.default.writeFileSync(configPathFor(cwd), JSON.stringify(config, null, 2) + `
|
|
197569
197714
|
`, "utf8");
|
|
197570
197715
|
};
|
|
197571
197716
|
var walkUpForPyproject2 = (start) => {
|
|
197572
|
-
let dir =
|
|
197573
|
-
while (dir !==
|
|
197574
|
-
if (
|
|
197717
|
+
let dir = import_node_path20.default.resolve(start);
|
|
197718
|
+
while (dir !== import_node_path20.default.dirname(dir)) {
|
|
197719
|
+
if (import_node_fs19.default.existsSync(import_node_path20.default.join(dir, "pyproject.toml")))
|
|
197575
197720
|
return dir;
|
|
197576
|
-
dir =
|
|
197721
|
+
dir = import_node_path20.default.dirname(dir);
|
|
197577
197722
|
}
|
|
197578
197723
|
return null;
|
|
197579
197724
|
};
|
|
197580
197725
|
var ensureBackendDir2 = async (cwd) => {
|
|
197581
197726
|
const config = readConfig2(cwd);
|
|
197582
197727
|
if (config.backendProjectDir) {
|
|
197583
|
-
const dir =
|
|
197584
|
-
if (
|
|
197728
|
+
const dir = import_node_path20.default.resolve(cwd, config.backendProjectDir);
|
|
197729
|
+
if (import_node_fs19.default.existsSync(dir) && import_node_fs19.default.statSync(dir).isDirectory())
|
|
197585
197730
|
return dir;
|
|
197586
197731
|
console.error(`[pieui] Configured backendProjectDir not found: ${dir}`);
|
|
197587
197732
|
}
|
|
@@ -197606,9 +197751,9 @@ var ensureBackendDir2 = async (cwd) => {
|
|
|
197606
197751
|
const raw = (await rl.question("[pieui] Path to backend (pie) project: ")).trim();
|
|
197607
197752
|
if (!raw)
|
|
197608
197753
|
return null;
|
|
197609
|
-
const expanded = raw.startsWith("~") ?
|
|
197610
|
-
const absolute =
|
|
197611
|
-
if (!
|
|
197754
|
+
const expanded = raw.startsWith("~") ? import_node_path20.default.join(process.env.HOME || "", raw.slice(1).replace(/^[\\/]/, "")) : raw;
|
|
197755
|
+
const absolute = import_node_path20.default.resolve(expanded);
|
|
197756
|
+
if (!import_node_fs19.default.existsSync(absolute) || !import_node_fs19.default.statSync(absolute).isDirectory()) {
|
|
197612
197757
|
console.error(`[pieui] Not a directory: ${absolute}`);
|
|
197613
197758
|
return null;
|
|
197614
197759
|
}
|
|
@@ -197642,11 +197787,11 @@ var generateCode = (length = CODE_LENGTH) => {
|
|
|
197642
197787
|
var tryOpenBrowser = (url) => {
|
|
197643
197788
|
try {
|
|
197644
197789
|
if (process.platform === "win32") {
|
|
197645
|
-
|
|
197790
|
+
import_node_child_process6.execFile("cmd", ["/c", "start", "", url], () => {});
|
|
197646
197791
|
} else if (process.platform === "darwin") {
|
|
197647
|
-
|
|
197792
|
+
import_node_child_process6.execFile("open", [url], () => {});
|
|
197648
197793
|
} else {
|
|
197649
|
-
|
|
197794
|
+
import_node_child_process6.execFile("xdg-open", [url], () => {});
|
|
197650
197795
|
}
|
|
197651
197796
|
} catch {}
|
|
197652
197797
|
};
|
|
@@ -197677,8 +197822,8 @@ var appendPieCredentialsToEnv = (cwd, config) => {
|
|
|
197677
197822
|
if (Object.keys(entries).length === 0) {
|
|
197678
197823
|
return;
|
|
197679
197824
|
}
|
|
197680
|
-
const envPath =
|
|
197681
|
-
let content =
|
|
197825
|
+
const envPath = import_node_path21.default.join(cwd, ".env");
|
|
197826
|
+
let content = import_node_fs20.default.existsSync(envPath) ? import_node_fs20.default.readFileSync(envPath, "utf8") : "";
|
|
197682
197827
|
if (content.length > 0 && !content.endsWith(`
|
|
197683
197828
|
`)) {
|
|
197684
197829
|
content += `
|
|
@@ -197688,7 +197833,7 @@ var appendPieCredentialsToEnv = (cwd, config) => {
|
|
|
197688
197833
|
content += `${additions.join(`
|
|
197689
197834
|
`)}
|
|
197690
197835
|
`;
|
|
197691
|
-
|
|
197836
|
+
import_node_fs20.default.writeFileSync(envPath, content, "utf8");
|
|
197692
197837
|
console.log(`[pie] Appended credentials to ${envPath}`);
|
|
197693
197838
|
};
|
|
197694
197839
|
async function loginCommand(options = {}) {
|
|
@@ -197709,8 +197854,8 @@ async function loginCommand(options = {}) {
|
|
|
197709
197854
|
try {
|
|
197710
197855
|
openBrowser(connectUrl);
|
|
197711
197856
|
} catch {}
|
|
197712
|
-
const pieDir =
|
|
197713
|
-
const configPath =
|
|
197857
|
+
const pieDir = import_node_path21.default.join(cwd, ".pie");
|
|
197858
|
+
const configPath = import_node_path21.default.join(pieDir, "config.json");
|
|
197714
197859
|
const url = `${credentialsApi}?${new URLSearchParams({ code }).toString()}`;
|
|
197715
197860
|
let first = true;
|
|
197716
197861
|
while (true) {
|
|
@@ -197744,7 +197889,7 @@ async function loginCommand(options = {}) {
|
|
|
197744
197889
|
throw new Error("Login succeeded but response had no 'config' field");
|
|
197745
197890
|
}
|
|
197746
197891
|
const credBlob = typeof record.config === "object" && record.config !== null && !Array.isArray(record.config) ? record.config : {};
|
|
197747
|
-
|
|
197892
|
+
import_node_fs20.default.mkdirSync(pieDir, { recursive: true });
|
|
197748
197893
|
mergeConfig(cwd, credBlob);
|
|
197749
197894
|
console.log(`[pie] Saved credentials to ${configPath}`);
|
|
197750
197895
|
appendPieCredentialsToEnv(cwd, record.config);
|
|
@@ -197759,9 +197904,9 @@ async function loginCommand(options = {}) {
|
|
|
197759
197904
|
}
|
|
197760
197905
|
|
|
197761
197906
|
// src/code/commands/selfUpgrade.ts
|
|
197762
|
-
var
|
|
197763
|
-
var
|
|
197764
|
-
var
|
|
197907
|
+
var import_node_child_process7 = require("node:child_process");
|
|
197908
|
+
var import_node_fs21 = __toESM(require("node:fs"));
|
|
197909
|
+
var import_node_path22 = __toESM(require("node:path"));
|
|
197765
197910
|
var __dirname = "/home/runner/work/pieui/pieui/src/code/commands";
|
|
197766
197911
|
var PACKAGE_NAME = "@swarm.ing/pieui";
|
|
197767
197912
|
var INSTALL_ARGS = {
|
|
@@ -197772,7 +197917,7 @@ var INSTALL_ARGS = {
|
|
|
197772
197917
|
};
|
|
197773
197918
|
var isPackageManager = (value2) => value2 === "bun" || value2 === "npm" || value2 === "pnpm" || value2 === "yarn";
|
|
197774
197919
|
var hasBinary = (bin) => {
|
|
197775
|
-
const result =
|
|
197920
|
+
const result = import_node_child_process7.spawnSync("which", [bin], { stdio: "ignore" });
|
|
197776
197921
|
return result.status === 0;
|
|
197777
197922
|
};
|
|
197778
197923
|
var detectPackageManager = () => {
|
|
@@ -197785,13 +197930,13 @@ var detectPackageManager = () => {
|
|
|
197785
197930
|
};
|
|
197786
197931
|
var readInstalledVersion = () => {
|
|
197787
197932
|
const candidates = [
|
|
197788
|
-
|
|
197789
|
-
|
|
197790
|
-
|
|
197933
|
+
import_node_path22.default.resolve(__dirname, "..", "package.json"),
|
|
197934
|
+
import_node_path22.default.resolve(__dirname, "..", "..", "package.json"),
|
|
197935
|
+
import_node_path22.default.resolve(__dirname, "..", "..", "..", "package.json")
|
|
197791
197936
|
];
|
|
197792
197937
|
for (const file of candidates) {
|
|
197793
197938
|
try {
|
|
197794
|
-
const raw =
|
|
197939
|
+
const raw = import_node_fs21.default.readFileSync(file, "utf8");
|
|
197795
197940
|
const parsed = JSON.parse(raw);
|
|
197796
197941
|
if (parsed.name === PACKAGE_NAME && parsed.version) {
|
|
197797
197942
|
return parsed.version;
|
|
@@ -197815,7 +197960,7 @@ var selfUpgradeCommand = async (override) => {
|
|
|
197815
197960
|
}
|
|
197816
197961
|
const args = INSTALL_ARGS[pm];
|
|
197817
197962
|
console.log(`[pieui] Upgrading via ${pm}: ${pm} ${args.join(" ")}`);
|
|
197818
|
-
const result =
|
|
197963
|
+
const result = import_node_child_process7.spawnSync(pm, args, {
|
|
197819
197964
|
stdio: "inherit",
|
|
197820
197965
|
env: process.env
|
|
197821
197966
|
});
|
|
@@ -197899,8 +198044,8 @@ var main = async () => {
|
|
|
197899
198044
|
await selfUpgradeCommand(args.selfUpgradePm);
|
|
197900
198045
|
return;
|
|
197901
198046
|
case "postbuild":
|
|
197902
|
-
console.log(`[pieui] Source directory: ${
|
|
197903
|
-
console.log(`[pieui] Output directory: ${
|
|
198047
|
+
console.log(`[pieui] Source directory: ${import_node_path23.default.resolve(process.cwd(), srcDir)}`);
|
|
198048
|
+
console.log(`[pieui] Output directory: ${import_node_path23.default.resolve(process.cwd(), outDir)}`);
|
|
197904
198049
|
console.log(`[pieui] Append mode: ${append}`);
|
|
197905
198050
|
await postbuildCommand(srcDir, outDir, append);
|
|
197906
198051
|
return;
|
|
@@ -197977,6 +198122,13 @@ var main = async () => {
|
|
|
197977
198122
|
cardAddStoryCommand(name, { force: cardAddStoryForce });
|
|
197978
198123
|
return;
|
|
197979
198124
|
}
|
|
198125
|
+
if (cardAction === "generate-preview") {
|
|
198126
|
+
const name = requireName(componentName, "Component name");
|
|
198127
|
+
await cardGeneratePreviewCommand(name, {
|
|
198128
|
+
out: args.cardGeneratePreviewOut
|
|
198129
|
+
});
|
|
198130
|
+
return;
|
|
198131
|
+
}
|
|
197980
198132
|
if (cardAction === "remote") {
|
|
197981
198133
|
if (cardRemoteAction === "list") {
|
|
197982
198134
|
await cardRemoteListCommand({
|
package/dist/code/args.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"args.d.ts","sourceRoot":"","sources":["../../src/code/args.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAOR,UAAU,EACb,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"args.d.ts","sourceRoot":"","sources":["../../src/code/args.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAOR,UAAU,EACb,MAAM,SAAS,CAAA;AA0KhB,eAAO,MAAM,SAAS,GAAI,MAAM,MAAM,EAAE,KAAG,UA8I1C,CAAA;AAED,MAAM,MAAM,SAAS,GACf,KAAK,GACL,OAAO,GACP,QAAQ,GACR,MAAM,GACN,WAAW,GACX,MAAM,GACN,aAAa,GACb,MAAM,GACN,cAAc,CAAA;AAEpB,eAAO,MAAM,eAAe,GAAI,MAAM,MAAM,EAAE,KAAG,SAAS,GAAG,IAe5D,CAAA;AA0MD,eAAO,MAAM,UAAU,GAAI,QAAO,SAAiB,SAwBlD,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cardAddStory.d.ts","sourceRoot":"","sources":["../../../src/code/commands/cardAddStory.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cardAddStory.d.ts","sourceRoot":"","sources":["../../../src/code/commands/cardAddStory.ts"],"names":[],"mappings":"AA4IA,eAAO,MAAM,mBAAmB,GAC5B,eAAe,MAAM,EACrB,UAAS;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAO,KAClC,IAyHF,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cardGeneratePreview.d.ts","sourceRoot":"","sources":["../../../src/code/commands/cardGeneratePreview.ts"],"names":[],"mappings":"AAqDA,eAAO,MAAM,0BAA0B,GACnC,eAAe,MAAM,EACrB,UAAS;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAO,KAC/B,OAAO,CAAC,IAAI,CAwHd,CAAA"}
|
package/dist/code/types.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export declare const MANIFEST_FILENAME = "pieui.components.json";
|
|
|
3
3
|
export declare const REGISTER_FUNCTION = "registerPieComponent";
|
|
4
4
|
export type ComponentType = 'simple' | 'complex' | 'simple-container' | 'complex-container';
|
|
5
5
|
export type ListFilter = 'all' | ComponentType;
|
|
6
|
-
export type CardAction = 'add' | 'list' | 'pull' | 'view' | 'remove' | 'list-events' | 'add-event' | 'remote' | 'dump-metadata' | 'check-sync' | 'add-story';
|
|
6
|
+
export type CardAction = 'add' | 'list' | 'pull' | 'view' | 'remove' | 'list-events' | 'add-event' | 'remote' | 'dump-metadata' | 'check-sync' | 'add-story' | 'generate-preview';
|
|
7
7
|
export type CardRemoteAction = 'push' | 'pull' | 'list' | 'remove' | 'history' | 'public' | 'private';
|
|
8
8
|
export type PageAction = 'add' | 'view' | 'ajax';
|
|
9
9
|
export type PageAjaxAction = 'add' | 'remove';
|
|
@@ -38,6 +38,7 @@ export type ParsedArgs = {
|
|
|
38
38
|
historyTo?: number;
|
|
39
39
|
selfUpgradePm?: string;
|
|
40
40
|
dumpMetadataOut?: string;
|
|
41
|
+
cardGeneratePreviewOut?: string;
|
|
41
42
|
};
|
|
42
43
|
export type CardScaffoldOptions = {
|
|
43
44
|
ajax?: boolean;
|
package/dist/code/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/code/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,wBAAwB,CAAA;AAElD,eAAO,MAAM,iBAAiB,0BAA0B,CAAA;AACxD,eAAO,MAAM,iBAAiB,yBAAyB,CAAA;AAEvD,MAAM,MAAM,aAAa,GACnB,QAAQ,GACR,SAAS,GACT,kBAAkB,GAClB,mBAAmB,CAAA;AAEzB,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,aAAa,CAAA;AAC9C,MAAM,MAAM,UAAU,GAChB,KAAK,GACL,MAAM,GACN,MAAM,GACN,MAAM,GACN,QAAQ,GACR,aAAa,GACb,WAAW,GACX,QAAQ,GACR,eAAe,GACf,YAAY,GACZ,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/code/types.ts"],"names":[],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preset.d.cts","sourceRoot":"","sources":["../../../src/storybook/addon/preset.cjs"],"names":[],"mappings":"AAgByB,qDAGxB"}
|
|
1
|
+
{"version":3,"file":"preset.d.cts","sourceRoot":"","sources":["../../../src/storybook/addon/preset.cjs"],"names":[],"mappings":"AAgByB,qDAGxB;AAQmB,qDAUnB"}
|
|
@@ -18,3 +18,21 @@ exports.managerEntries = (entry = []) => [
|
|
|
18
18
|
...entry,
|
|
19
19
|
path.join(__dirname, 'manager.js'),
|
|
20
20
|
]
|
|
21
|
+
|
|
22
|
+
// Force-dedupe React and pieui so linked installs (`file:`/`npm link`) that
|
|
23
|
+
// drag pieui's own node_modules along don't end up with two React instances.
|
|
24
|
+
// Two Reacts → two distinct PieConfigContext objects → providers and
|
|
25
|
+
// consumers don't match → "must be used within PieConfigProvider". Published
|
|
26
|
+
// npm installs already dedupe via peerDependencies; declaring this here is a
|
|
27
|
+
// safe no-op there.
|
|
28
|
+
exports.viteFinal = async (config) => {
|
|
29
|
+
config.resolve = config.resolve || {}
|
|
30
|
+
const dedupe = new Set([
|
|
31
|
+
...(config.resolve.dedupe || []),
|
|
32
|
+
'react',
|
|
33
|
+
'react-dom',
|
|
34
|
+
'@swarm.ing/pieui',
|
|
35
|
+
])
|
|
36
|
+
config.resolve.dedupe = Array.from(dedupe)
|
|
37
|
+
return config
|
|
38
|
+
}
|