@swarm.ing/pieui 3.0.1 → 3.0.3

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 CHANGED
@@ -196101,16 +196101,6 @@ var patchSchemaForType = (type, schema, checker, visited = new Set) => {
196101
196101
  delete schema.required;
196102
196102
  return;
196103
196103
  }
196104
- const stringIndexType = normalizedType.getStringIndexType?.();
196105
- if (stringIndexType) {
196106
- const indexSchema = schemaForIndexType(stringIndexType, checker);
196107
- schema.type = "object";
196108
- schema.additionalProperties = indexSchema;
196109
- if (schema.properties && Object.keys(schema.properties).length === 0) {
196110
- delete schema.properties;
196111
- delete schema.required;
196112
- }
196113
- }
196114
196104
  if (checker.isTupleType(normalizedType)) {
196115
196105
  const elementTypes = checker.getTypeArguments(normalizedType);
196116
196106
  if (schema.items && Array.isArray(schema.items)) {
@@ -196127,6 +196117,16 @@ var patchSchemaForType = (type, schema, checker, visited = new Set) => {
196127
196117
  }
196128
196118
  return;
196129
196119
  }
196120
+ const stringIndexType = normalizedType.getStringIndexType?.();
196121
+ if (stringIndexType) {
196122
+ const indexSchema = schemaForIndexType(stringIndexType, checker);
196123
+ schema.type = "object";
196124
+ schema.additionalProperties = indexSchema;
196125
+ if (schema.properties && Object.keys(schema.properties).length === 0) {
196126
+ delete schema.properties;
196127
+ delete schema.required;
196128
+ }
196129
+ }
196130
196130
  if (normalizedType.isUnion() && Array.isArray(schema.anyOf)) {
196131
196131
  const unionTypes = normalizedType.types;
196132
196132
  for (let i = 0;i < schema.anyOf.length && i < unionTypes.length; i += 1) {
@@ -196293,7 +196293,7 @@ var postbuildCommand = async (srcDir, outDir, append) => {
196293
196293
  };
196294
196294
 
196295
196295
  // src/code/commands/cardRemote/push.ts
196296
- var import_node_fs7 = __toESM(require("node:fs"));
196296
+ var import_node_fs8 = __toESM(require("node:fs"));
196297
196297
  var import_node_path9 = __toESM(require("node:path"));
196298
196298
 
196299
196299
  // src/code/services/settings.ts
@@ -196833,7 +196833,7 @@ ${detail}` : `${opts.method} ${opts.url} failed: ${response.status}`;
196833
196833
  }
196834
196834
 
196835
196835
  // src/code/commands/cardDumpMetadata.ts
196836
- var import_node_fs6 = __toESM(require("node:fs"));
196836
+ var import_node_fs7 = __toESM(require("node:fs"));
196837
196837
  var import_node_path8 = __toESM(require("node:path"));
196838
196838
 
196839
196839
  // src/code/introspection/errors.ts
@@ -196911,6 +196911,7 @@ var errorOptsFromNode = (sourceFile, node) => ({
196911
196911
  });
196912
196912
 
196913
196913
  // src/code/introspection/schemaContext.ts
196914
+ var import_node_fs4 = __toESM(require("node:fs"));
196914
196915
  var import_node_path5 = __toESM(require("node:path"));
196915
196916
  var __dirname = "/home/runner/work/pieui/pieui/src/code/introspection";
196916
196917
  var DEFAULT_COMPILER_OPTIONS = () => ({
@@ -196923,10 +196924,43 @@ var DEFAULT_COMPILER_OPTIONS = () => ({
196923
196924
  allowSyntheticDefaultImports: true,
196924
196925
  skipLibCheck: true
196925
196926
  });
196927
+ var findTsconfig = (fromDir) => {
196928
+ let dir = import_node_path5.default.resolve(fromDir);
196929
+ for (;; ) {
196930
+ const candidate = import_node_path5.default.join(dir, "tsconfig.json");
196931
+ if (import_node_fs4.default.existsSync(candidate))
196932
+ return candidate;
196933
+ const parent = import_node_path5.default.dirname(dir);
196934
+ if (parent === dir)
196935
+ return null;
196936
+ dir = parent;
196937
+ }
196938
+ };
196939
+ var loadPathAliases = (files) => {
196940
+ const seed = files.find((f) => !f.endsWith(".d.ts")) ?? files[0];
196941
+ if (!seed)
196942
+ return {};
196943
+ const tsconfigPath = findTsconfig(import_node_path5.default.dirname(import_node_path5.default.resolve(seed)));
196944
+ if (!tsconfigPath)
196945
+ return {};
196946
+ const configDir = import_node_path5.default.dirname(tsconfigPath);
196947
+ const read = ts2.readConfigFile(tsconfigPath, ts2.sys.readFile);
196948
+ if (read.error || !read.config)
196949
+ return {};
196950
+ const parsed = ts2.parseJsonConfigFileContent(read.config, ts2.sys, configDir);
196951
+ const options = parsed.options ?? {};
196952
+ if (!options.paths && !options.baseUrl)
196953
+ return {};
196954
+ return { baseUrl: options.baseUrl ?? configDir, paths: options.paths };
196955
+ };
196926
196956
  var createSchemaContext = (files) => {
196927
196957
  const cliSchemaPath = import_node_path5.default.join(__dirname, "..", "commands", "cli-schema.d.ts");
196928
196958
  const uniqueFiles = Array.from(new Set([cliSchemaPath, ...files]));
196929
- const program = TJS.getProgramFromFiles(uniqueFiles, DEFAULT_COMPILER_OPTIONS());
196959
+ const compilerOptions = {
196960
+ ...DEFAULT_COMPILER_OPTIONS(),
196961
+ ...loadPathAliases(files)
196962
+ };
196963
+ const program = TJS.getProgramFromFiles(uniqueFiles, compilerOptions);
196930
196964
  const checker = program.getTypeChecker();
196931
196965
  const generator = TJS.buildGenerator(program, {
196932
196966
  required: true,
@@ -197135,23 +197169,23 @@ var collectComponentFiles = (componentDir) => {
197135
197169
  return Array.from(out).sort();
197136
197170
  };
197137
197171
  // src/code/introspection/extractImports.ts
197138
- var import_node_fs4 = __toESM(require("node:fs"));
197172
+ var import_node_fs5 = __toESM(require("node:fs"));
197139
197173
  var import_node_path7 = __toESM(require("node:path"));
197140
197174
  var createHost = (cwd) => {
197141
197175
  const sys = ts2.sys;
197142
197176
  return {
197143
- fileExists: (name) => sys ? sys.fileExists(name) : import_node_fs4.default.existsSync(name),
197177
+ fileExists: (name) => sys ? sys.fileExists(name) : import_node_fs5.default.existsSync(name),
197144
197178
  readFile: (name) => {
197145
197179
  if (sys)
197146
197180
  return sys.readFile(name);
197147
197181
  try {
197148
- return import_node_fs4.default.readFileSync(name, "utf8");
197182
+ return import_node_fs5.default.readFileSync(name, "utf8");
197149
197183
  } catch {
197150
197184
  return;
197151
197185
  }
197152
197186
  },
197153
- directoryExists: (name) => sys ? sys.directoryExists(name) : import_node_fs4.default.existsSync(name) && import_node_fs4.default.statSync(name).isDirectory(),
197154
- getDirectories: (name) => sys ? sys.getDirectories(name) : import_node_fs4.default.existsSync(name) ? import_node_fs4.default.readdirSync(name, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => e.name) : [],
197187
+ directoryExists: (name) => sys ? sys.directoryExists(name) : import_node_fs5.default.existsSync(name) && import_node_fs5.default.statSync(name).isDirectory(),
197188
+ getDirectories: (name) => sys ? sys.getDirectories(name) : import_node_fs5.default.existsSync(name) ? import_node_fs5.default.readdirSync(name, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => e.name) : [],
197155
197189
  getCurrentDirectory: () => cwd,
197156
197190
  useCaseSensitiveFileNames: sys ? sys.useCaseSensitiveFileNames : true,
197157
197191
  realpath: sys?.realpath
@@ -197159,10 +197193,10 @@ var createHost = (cwd) => {
197159
197193
  };
197160
197194
  var readTsconfig = (cwd) => {
197161
197195
  const tsconfigPath = import_node_path7.default.join(cwd, "tsconfig.json");
197162
- if (!import_node_fs4.default.existsSync(tsconfigPath))
197196
+ if (!import_node_fs5.default.existsSync(tsconfigPath))
197163
197197
  return {};
197164
197198
  try {
197165
- const raw = import_node_fs4.default.readFileSync(tsconfigPath, "utf8");
197199
+ const raw = import_node_fs5.default.readFileSync(tsconfigPath, "utf8");
197166
197200
  const result = ts2.parseConfigFileTextToJson(tsconfigPath, raw);
197167
197201
  const parsed = result?.config;
197168
197202
  if (!parsed)
@@ -197214,13 +197248,13 @@ var tryExtensions = (candidate) => {
197214
197248
  const exts = ["", ".ts", ".tsx", ".d.ts", ".js", ".jsx"];
197215
197249
  for (const ext of exts) {
197216
197250
  const file = candidate + ext;
197217
- if (import_node_fs4.default.existsSync(file) && import_node_fs4.default.statSync(file).isFile())
197251
+ if (import_node_fs5.default.existsSync(file) && import_node_fs5.default.statSync(file).isFile())
197218
197252
  return file;
197219
197253
  }
197220
- if (import_node_fs4.default.existsSync(candidate) && import_node_fs4.default.statSync(candidate).isDirectory()) {
197254
+ if (import_node_fs5.default.existsSync(candidate) && import_node_fs5.default.statSync(candidate).isDirectory()) {
197221
197255
  for (const ext of ["index.ts", "index.tsx", "index.js"]) {
197222
197256
  const file = import_node_path7.default.join(candidate, ext);
197223
- if (import_node_fs4.default.existsSync(file))
197257
+ if (import_node_fs5.default.existsSync(file))
197224
197258
  return file;
197225
197259
  }
197226
197260
  }
@@ -197263,10 +197297,10 @@ var isInside = (child, parent) => {
197263
197297
  var isNodeModulesPath = (file) => file.includes(`${import_node_path7.default.sep}node_modules${import_node_path7.default.sep}`);
197264
197298
  var readPackageDeps = (cwd) => {
197265
197299
  const pkgPath = import_node_path7.default.join(cwd, "package.json");
197266
- if (!import_node_fs4.default.existsSync(pkgPath))
197300
+ if (!import_node_fs5.default.existsSync(pkgPath))
197267
197301
  return {};
197268
197302
  try {
197269
- const raw = import_node_fs4.default.readFileSync(pkgPath, "utf8");
197303
+ const raw = import_node_fs5.default.readFileSync(pkgPath, "utf8");
197270
197304
  const pkg = JSON.parse(raw);
197271
197305
  return {
197272
197306
  ...pkg.dependencies,
@@ -197333,7 +197367,7 @@ var extractImports = (files, cwd = process.cwd()) => {
197333
197367
  };
197334
197368
  };
197335
197369
  // src/code/introspection/extractEvents.ts
197336
- var import_node_fs5 = __toESM(require("node:fs"));
197370
+ var import_node_fs6 = __toESM(require("node:fs"));
197337
197371
  var PIE_CARD_TAG = "PieCard";
197338
197372
  var METHODS_PROP = "methods";
197339
197373
  var isPieCardJsx = (node) => {
@@ -197400,7 +197434,7 @@ var extractEvents = (files) => {
197400
197434
  for (const file of files) {
197401
197435
  let text;
197402
197436
  try {
197403
- text = import_node_fs5.default.readFileSync(file, "utf8");
197437
+ text = import_node_fs6.default.readFileSync(file, "utf8");
197404
197438
  } catch {
197405
197439
  continue;
197406
197440
  }
@@ -197907,7 +197941,7 @@ var stableStringify = (value2) => {
197907
197941
  var buildCardMetadata = (componentName) => {
197908
197942
  const settings = loadSettings();
197909
197943
  const componentDir = import_node_path8.default.join(settings.componentsDir, componentName);
197910
- if (!import_node_fs6.default.existsSync(componentDir)) {
197944
+ if (!import_node_fs7.default.existsSync(componentDir)) {
197911
197945
  throw new Error(`Component directory not found: ${componentDir}`);
197912
197946
  }
197913
197947
  const files = collectComponentFiles(componentDir);
@@ -197919,7 +197953,7 @@ var buildCardMetadata = (componentName) => {
197919
197953
  const componentsDir = settings.componentsDir;
197920
197954
  const fileEntries = files.map((absPath) => ({
197921
197955
  path: import_node_path8.default.relative(componentsDir, absPath),
197922
- content: import_node_fs6.default.readFileSync(absPath, "utf8")
197956
+ content: import_node_fs7.default.readFileSync(absPath, "utf8")
197923
197957
  }));
197924
197958
  const dataType = findComponentDataTypeForName(ctx, componentName);
197925
197959
  const propsCode = dataType.declaration.getText();
@@ -197961,11 +197995,11 @@ var buildCardMetadata = (componentName) => {
197961
197995
  };
197962
197996
  var DUMP_METADATA_ENVELOPE_KEY = "typescript";
197963
197997
  var mergeEnvelopeIntoFile = (target, envelope) => {
197964
- if (!import_node_fs6.default.existsSync(target))
197998
+ if (!import_node_fs7.default.existsSync(target))
197965
197999
  return envelope;
197966
198000
  let existing;
197967
198001
  try {
197968
- existing = JSON.parse(import_node_fs6.default.readFileSync(target, "utf8"));
198002
+ existing = JSON.parse(import_node_fs7.default.readFileSync(target, "utf8"));
197969
198003
  } catch (e) {
197970
198004
  throw new Error(`[pieui] Cannot merge: existing file ${target} is not valid JSON ` + `(${e.message})`);
197971
198005
  }
@@ -197983,8 +198017,8 @@ var cardDumpMetadataCommand = (componentName, outFile) => {
197983
198017
  const resolved = import_node_path8.default.resolve(process.cwd(), outFile);
197984
198018
  const merged = mergeEnvelopeIntoFile(resolved, envelope);
197985
198019
  const json = stableStringify(merged);
197986
- import_node_fs6.default.mkdirSync(import_node_path8.default.dirname(resolved), { recursive: true });
197987
- import_node_fs6.default.writeFileSync(resolved, json, "utf8");
198020
+ import_node_fs7.default.mkdirSync(import_node_path8.default.dirname(resolved), { recursive: true });
198021
+ import_node_fs7.default.writeFileSync(resolved, json, "utf8");
197988
198022
  console.log(`[pieui] Wrote metadata: ${resolved}`);
197989
198023
  } else {
197990
198024
  process.stdout.write(stableStringify(envelope));
@@ -198066,7 +198100,7 @@ var cardRemotePushCommand = async (cardRef) => {
198066
198100
  throw new Error("user_id is required (set PIE_USER_ID in env or .env; run `pieui login`)");
198067
198101
  }
198068
198102
  const componentDir = import_node_path9.default.join(settings.componentsDir, componentName);
198069
- if (!import_node_fs7.default.existsSync(componentDir) || !import_node_fs7.default.statSync(componentDir).isDirectory()) {
198103
+ if (!import_node_fs8.default.existsSync(componentDir) || !import_node_fs8.default.statSync(componentDir).isDirectory()) {
198070
198104
  throw new Error(`Component directory not found: ${componentDir}`);
198071
198105
  }
198072
198106
  const meta = buildCardMetadata(componentName);
@@ -198097,11 +198131,11 @@ var latestRevisionNumber = async (service, componentName) => {
198097
198131
  };
198098
198132
 
198099
198133
  // src/code/commands/cardRemote/pull.ts
198100
- var import_node_fs9 = __toESM(require("node:fs"));
198134
+ var import_node_fs10 = __toESM(require("node:fs"));
198101
198135
  var import_node_path11 = __toESM(require("node:path"));
198102
198136
 
198103
198137
  // src/code/services/dumpEnvelope.ts
198104
- var import_node_fs8 = __toESM(require("node:fs"));
198138
+ var import_node_fs9 = __toESM(require("node:fs"));
198105
198139
  var import_node_path10 = __toESM(require("node:path"));
198106
198140
  var unwrapTypescriptEnvelope = (parsed) => {
198107
198141
  if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
@@ -198139,15 +198173,15 @@ var restoreComponentFromEnvelope = (envelope, label) => {
198139
198173
  }
198140
198174
  planned.push({ target, content: fe2.content });
198141
198175
  }
198142
- import_node_fs8.default.mkdirSync(settings.componentsDir, { recursive: true });
198176
+ import_node_fs9.default.mkdirSync(settings.componentsDir, { recursive: true });
198143
198177
  const componentDir = import_node_path10.default.join(settings.componentsDir, componentName);
198144
- if (import_node_fs8.default.existsSync(componentDir)) {
198145
- import_node_fs8.default.rmSync(componentDir, { recursive: true, force: true });
198178
+ if (import_node_fs9.default.existsSync(componentDir)) {
198179
+ import_node_fs9.default.rmSync(componentDir, { recursive: true, force: true });
198146
198180
  }
198147
198181
  const written = [];
198148
198182
  for (const item of planned) {
198149
- import_node_fs8.default.mkdirSync(import_node_path10.default.dirname(item.target), { recursive: true });
198150
- import_node_fs8.default.writeFileSync(item.target, item.content, "utf8");
198183
+ import_node_fs9.default.mkdirSync(import_node_path10.default.dirname(item.target), { recursive: true });
198184
+ import_node_fs9.default.writeFileSync(item.target, item.content, "utf8");
198151
198185
  written.push(item.target);
198152
198186
  }
198153
198187
  return { componentName, written };
@@ -198178,7 +198212,7 @@ var cardRemotePullCommand = async (cardRef) => {
198178
198212
  const sourceLabel = isPublic ? `r/${effectiveUserId}/${componentName}` : ref.project ? `${effectiveProject}/${componentName}` : componentName;
198179
198213
  const suffix = revision !== undefined ? `@${revision}` : "";
198180
198214
  const service = new PieStorageService(settings);
198181
- import_node_fs9.default.mkdirSync(settings.componentsDir, { recursive: true });
198215
+ import_node_fs10.default.mkdirSync(settings.componentsDir, { recursive: true });
198182
198216
  if (isPublic) {
198183
198217
  await pullPublicViaTree(service, settings.componentsDir, {
198184
198218
  componentName,
@@ -198205,8 +198239,8 @@ var cardRemotePullCommand = async (cardRef) => {
198205
198239
  var pullPublicViaTree = async (service, componentsDir, args) => {
198206
198240
  const componentDir = import_node_path11.default.join(componentsDir, args.componentName);
198207
198241
  const tempDir = `${componentDir}.pieui-tmp-${process.pid}-${Date.now()}`;
198208
- import_node_fs9.default.rmSync(tempDir, { recursive: true, force: true });
198209
- import_node_fs9.default.mkdirSync(tempDir, { recursive: true });
198242
+ import_node_fs10.default.rmSync(tempDir, { recursive: true, force: true });
198243
+ import_node_fs10.default.mkdirSync(tempDir, { recursive: true });
198210
198244
  let downloaded;
198211
198245
  try {
198212
198246
  downloaded = await service.downloadComponentDirectory({
@@ -198216,24 +198250,24 @@ var pullPublicViaTree = async (service, componentsDir, args) => {
198216
198250
  isPublic: true
198217
198251
  });
198218
198252
  } catch (error) {
198219
- import_node_fs9.default.rmSync(tempDir, { recursive: true, force: true });
198253
+ import_node_fs10.default.rmSync(tempDir, { recursive: true, force: true });
198220
198254
  throw error;
198221
198255
  }
198222
198256
  if (downloaded.length === 0) {
198223
- import_node_fs9.default.rmSync(tempDir, { recursive: true, force: true });
198257
+ import_node_fs10.default.rmSync(tempDir, { recursive: true, force: true });
198224
198258
  throw new Error(`No typescript files found for remote component r/${args.userId}/${args.componentName} ` + `(user_id=${args.userId} (public))`);
198225
198259
  }
198226
- if (import_node_fs9.default.existsSync(componentDir)) {
198227
- import_node_fs9.default.rmSync(componentDir, { recursive: true, force: true });
198260
+ if (import_node_fs10.default.existsSync(componentDir)) {
198261
+ import_node_fs10.default.rmSync(componentDir, { recursive: true, force: true });
198228
198262
  }
198229
- import_node_fs9.default.renameSync(tempDir, componentDir);
198263
+ import_node_fs10.default.renameSync(tempDir, componentDir);
198230
198264
  };
198231
198265
  var walkFiles = (dir) => {
198232
198266
  const out = [];
198233
- if (!import_node_fs9.default.existsSync(dir))
198267
+ if (!import_node_fs10.default.existsSync(dir))
198234
198268
  return out;
198235
198269
  const walk = (d) => {
198236
- for (const entry of import_node_fs9.default.readdirSync(d, { withFileTypes: true })) {
198270
+ for (const entry of import_node_fs10.default.readdirSync(d, { withFileTypes: true })) {
198237
198271
  const abs = import_node_path11.default.join(d, entry.name);
198238
198272
  if (entry.isDirectory())
198239
198273
  walk(abs);
@@ -198388,7 +198422,7 @@ var cardRemotePrivateCommand = async (componentName) => {
198388
198422
  };
198389
198423
 
198390
198424
  // src/code/commands/cardPull.ts
198391
- var import_node_fs10 = __toESM(require("node:fs"));
198425
+ var import_node_fs11 = __toESM(require("node:fs"));
198392
198426
  var import_node_path12 = __toESM(require("node:path"));
198393
198427
  var isHttpUrl = (ref) => /^https?:\/\//i.test(ref);
198394
198428
  var isLocalJsonPath = (ref) => {
@@ -198397,7 +198431,7 @@ var isLocalJsonPath = (ref) => {
198397
198431
  }
198398
198432
  if (!ref.endsWith(".json"))
198399
198433
  return false;
198400
- return import_node_fs10.default.existsSync(import_node_path12.default.resolve(process.cwd(), ref));
198434
+ return import_node_fs11.default.existsSync(import_node_path12.default.resolve(process.cwd(), ref));
198401
198435
  };
198402
198436
  var fetchJsonText = async (url) => {
198403
198437
  const res = await fetch(url);
@@ -198421,13 +198455,13 @@ var cardPullCommand = async (cardRef) => {
198421
198455
  }
198422
198456
  if (isLocalJsonPath(cardRef)) {
198423
198457
  const abs = import_node_path12.default.resolve(process.cwd(), cardRef);
198424
- if (!import_node_fs10.default.existsSync(abs)) {
198458
+ if (!import_node_fs11.default.existsSync(abs)) {
198425
198459
  throw new Error(`Pull source not found: ${abs}`);
198426
198460
  }
198427
- if (!import_node_fs10.default.statSync(abs).isFile()) {
198461
+ if (!import_node_fs11.default.statSync(abs).isFile()) {
198428
198462
  throw new Error(`Pull source is not a file: ${abs}`);
198429
198463
  }
198430
- const { componentName, written } = restoreComponentFromEnvelopeText(import_node_fs10.default.readFileSync(abs, "utf8"), abs);
198464
+ const { componentName, written } = restoreComponentFromEnvelopeText(import_node_fs11.default.readFileSync(abs, "utf8"), abs);
198431
198465
  printRestoreOutput(componentName, written, abs);
198432
198466
  return;
198433
198467
  }
@@ -198435,7 +198469,7 @@ var cardPullCommand = async (cardRef) => {
198435
198469
  };
198436
198470
 
198437
198471
  // src/code/commands/cardView.ts
198438
- var import_node_fs11 = __toESM(require("node:fs"));
198472
+ var import_node_fs12 = __toESM(require("node:fs"));
198439
198473
  var import_node_path13 = __toESM(require("node:path"));
198440
198474
  var AJAX_FIELD_NAMES = new Set(["pathname", "deps_names", "kwargs"]);
198441
198475
  var IO_FIELD_RE = /\buse_[A-Za-z0-9_]+_support\b/g;
@@ -198484,14 +198518,14 @@ var formatTable = (headers, rows) => {
198484
198518
  var cardViewCommand = (componentName) => {
198485
198519
  const settings = loadSettings();
198486
198520
  const componentDir = import_node_path13.default.join(settings.componentsDir, componentName);
198487
- if (!import_node_fs11.default.existsSync(componentDir)) {
198521
+ if (!import_node_fs12.default.existsSync(componentDir)) {
198488
198522
  throw new Error(`Component directory not found: ${componentDir}`);
198489
198523
  }
198490
198524
  const typesPath = import_node_path13.default.join(componentDir, "types.ts");
198491
198525
  const indexPath = import_node_path13.default.join(componentDir, "index.tsx");
198492
198526
  const indexPathTs = import_node_path13.default.join(componentDir, "index.ts");
198493
- const typesSource = import_node_fs11.default.existsSync(typesPath) ? import_node_fs11.default.readFileSync(typesPath, "utf8") : "";
198494
- const indexSource = import_node_fs11.default.existsSync(indexPath) ? import_node_fs11.default.readFileSync(indexPath, "utf8") : import_node_fs11.default.existsSync(indexPathTs) ? import_node_fs11.default.readFileSync(indexPathTs, "utf8") : "";
198527
+ const typesSource = import_node_fs12.default.existsSync(typesPath) ? import_node_fs12.default.readFileSync(typesPath, "utf8") : "";
198528
+ const indexSource = import_node_fs12.default.existsSync(indexPath) ? import_node_fs12.default.readFileSync(indexPath, "utf8") : import_node_fs12.default.existsSync(indexPathTs) ? import_node_fs12.default.readFileSync(indexPathTs, "utf8") : "";
198495
198529
  const dataInterface = extractInterfaceBody(typesSource, `${componentName}Data`) ?? "";
198496
198530
  const props = parseProps(dataInterface);
198497
198531
  const hasAjax = props.some((p) => AJAX_FIELD_NAMES.has(p.name));
@@ -198539,7 +198573,7 @@ var cardViewCommand = (componentName) => {
198539
198573
  };
198540
198574
 
198541
198575
  // src/code/commands/cardCheckSync.ts
198542
- var import_node_fs12 = __toESM(require("node:fs"));
198576
+ var import_node_fs13 = __toESM(require("node:fs"));
198543
198577
  var import_node_path14 = __toESM(require("node:path"));
198544
198578
  var import_node_child_process2 = require("node:child_process");
198545
198579
  var readline2 = __toESM(require("node:readline/promises"));
@@ -198547,10 +198581,10 @@ var PIE_CONFIG_DIR2 = ".pie";
198547
198581
  var PIE_CONFIG_FILE2 = "config.json";
198548
198582
  var readConfig = (cwd) => {
198549
198583
  const configPath = import_node_path14.default.join(cwd, PIE_CONFIG_DIR2, PIE_CONFIG_FILE2);
198550
- if (!import_node_fs12.default.existsSync(configPath))
198584
+ if (!import_node_fs13.default.existsSync(configPath))
198551
198585
  return {};
198552
198586
  try {
198553
- const parsed = JSON.parse(import_node_fs12.default.readFileSync(configPath, "utf8"));
198587
+ const parsed = JSON.parse(import_node_fs13.default.readFileSync(configPath, "utf8"));
198554
198588
  return typeof parsed === "object" && parsed !== null && !Array.isArray(parsed) ? parsed : {};
198555
198589
  } catch {
198556
198590
  return {};
@@ -198558,15 +198592,15 @@ var readConfig = (cwd) => {
198558
198592
  };
198559
198593
  var writeConfig = (cwd, config) => {
198560
198594
  const dir = import_node_path14.default.join(cwd, PIE_CONFIG_DIR2);
198561
- import_node_fs12.default.mkdirSync(dir, { recursive: true });
198595
+ import_node_fs13.default.mkdirSync(dir, { recursive: true });
198562
198596
  const configPath = import_node_path14.default.join(dir, PIE_CONFIG_FILE2);
198563
- import_node_fs12.default.writeFileSync(configPath, JSON.stringify(config, null, 2) + `
198597
+ import_node_fs13.default.writeFileSync(configPath, JSON.stringify(config, null, 2) + `
198564
198598
  `, "utf8");
198565
198599
  };
198566
198600
  var walkUpForPyproject = (start) => {
198567
198601
  let dir = import_node_path14.default.resolve(start);
198568
198602
  while (dir !== import_node_path14.default.dirname(dir)) {
198569
- if (import_node_fs12.default.existsSync(import_node_path14.default.join(dir, "pyproject.toml")))
198603
+ if (import_node_fs13.default.existsSync(import_node_path14.default.join(dir, "pyproject.toml")))
198570
198604
  return dir;
198571
198605
  dir = import_node_path14.default.dirname(dir);
198572
198606
  }
@@ -198576,7 +198610,7 @@ var ensureBackendDir = async (cwd) => {
198576
198610
  const config = readConfig(cwd);
198577
198611
  if (config.backendProjectDir) {
198578
198612
  const dir = import_node_path14.default.resolve(cwd, config.backendProjectDir);
198579
- if (import_node_fs12.default.existsSync(dir) && import_node_fs12.default.statSync(dir).isDirectory())
198613
+ if (import_node_fs13.default.existsSync(dir) && import_node_fs13.default.statSync(dir).isDirectory())
198580
198614
  return dir;
198581
198615
  console.error(`[pieui] Configured backendProjectDir not found: ${dir}`);
198582
198616
  }
@@ -198603,7 +198637,7 @@ var ensureBackendDir = async (cwd) => {
198603
198637
  return null;
198604
198638
  const expanded = raw.startsWith("~") ? import_node_path14.default.join(process.env.HOME || "", raw.slice(1).replace(/^[\\/]/, "")) : raw;
198605
198639
  const absolute = import_node_path14.default.resolve(expanded);
198606
- if (!import_node_fs12.default.existsSync(absolute) || !import_node_fs12.default.statSync(absolute).isDirectory()) {
198640
+ if (!import_node_fs13.default.existsSync(absolute) || !import_node_fs13.default.statSync(absolute).isDirectory()) {
198607
198641
  console.error(`[pieui] Not a directory: ${absolute}`);
198608
198642
  return null;
198609
198643
  }
@@ -198621,7 +198655,7 @@ var findVenvPython = (project) => {
198621
198655
  return override;
198622
198656
  for (const sub of [".venv", "venv"]) {
198623
198657
  const candidate = import_node_path14.default.join(project, sub, "bin", "python");
198624
- if (import_node_fs12.default.existsSync(candidate))
198658
+ if (import_node_fs13.default.existsSync(candidate))
198625
198659
  return candidate;
198626
198660
  }
198627
198661
  return "python3";
@@ -198654,11 +198688,11 @@ var cardCheckSyncCommand = async (componentName) => {
198654
198688
  };
198655
198689
 
198656
198690
  // src/code/commands/cardAddStory.ts
198657
- var import_node_fs14 = __toESM(require("node:fs"));
198691
+ var import_node_fs15 = __toESM(require("node:fs"));
198658
198692
  var import_node_path15 = __toESM(require("node:path"));
198659
198693
 
198660
198694
  // src/code/patchPieCardForwarding.ts
198661
- var import_node_fs13 = __toESM(require("node:fs"));
198695
+ var import_node_fs14 = __toESM(require("node:fs"));
198662
198696
  var IO_FIELDS = [
198663
198697
  "useSocketioSupport",
198664
198698
  "useCentrifugeSupport",
@@ -198667,9 +198701,9 @@ var IO_FIELDS = [
198667
198701
  ];
198668
198702
  var FIELD_DECL_RE = (name) => new RegExp(`(^|[\\s\\{,;])${name}\\s*\\??\\s*:`);
198669
198703
  var detectCardIsIO = (typesPath) => {
198670
- if (!import_node_fs13.default.existsSync(typesPath))
198704
+ if (!import_node_fs14.default.existsSync(typesPath))
198671
198705
  return false;
198672
- const source = import_node_fs13.default.readFileSync(typesPath, "utf8");
198706
+ const source = import_node_fs14.default.readFileSync(typesPath, "utf8");
198673
198707
  return IO_FIELDS.some((field) => FIELD_DECL_RE(field).test(source));
198674
198708
  };
198675
198709
  var forwardingPropsFor = (isIO) => {
@@ -198710,10 +198744,10 @@ var indentOfFirstAttr = (source, sourceFile, attrs) => {
198710
198744
  return { indent: " ", multiline: false };
198711
198745
  };
198712
198746
  var patchPieCardForwarding = (uiPath, options = { io: false }) => {
198713
- if (!import_node_fs13.default.existsSync(uiPath)) {
198747
+ if (!import_node_fs14.default.existsSync(uiPath)) {
198714
198748
  return { patched: false, addedPerSite: [] };
198715
198749
  }
198716
- const source = import_node_fs13.default.readFileSync(uiPath, "utf8");
198750
+ const source = import_node_fs14.default.readFileSync(uiPath, "utf8");
198717
198751
  const sourceFile = ts2.createSourceFile(uiPath, source, ts2.ScriptTarget.ES2020, true, ts2.ScriptKind.TSX);
198718
198752
  const required = forwardingPropsFor(options.io);
198719
198753
  const insertions = [];
@@ -198757,7 +198791,7 @@ ${indent}${p.name}={${p.expr}}` : ` ${p.name}={${p.expr}}`).join("");
198757
198791
  for (const ins of insertions) {
198758
198792
  result = result.slice(0, ins.pos) + ins.text + result.slice(ins.pos);
198759
198793
  }
198760
- import_node_fs13.default.writeFileSync(uiPath, result, "utf8");
198794
+ import_node_fs14.default.writeFileSync(uiPath, result, "utf8");
198761
198795
  return { patched: true, addedPerSite };
198762
198796
  };
198763
198797
 
@@ -198872,7 +198906,7 @@ var cardAddStoryCommand = (componentName, options = {}) => {
198872
198906
  }
198873
198907
  const settings = loadSettings();
198874
198908
  const componentDir = import_node_path15.default.join(settings.componentsDir, componentName);
198875
- if (!import_node_fs14.default.existsSync(componentDir)) {
198909
+ if (!import_node_fs15.default.existsSync(componentDir)) {
198876
198910
  throw new Error(`Component directory not found: ${componentDir}`);
198877
198911
  }
198878
198912
  const tsFiles = collectComponentFiles2(componentDir).filter((f) => COMPONENT_EXTS4.some((e) => f.endsWith(e)));
@@ -198900,12 +198934,12 @@ var cardAddStoryCommand = (componentName, options = {}) => {
198900
198934
  const uiPath = import_node_path15.default.join(componentDir, "ui", `${componentName}.tsx`);
198901
198935
  const io = detectCardIsIO(typesPath);
198902
198936
  const storyPath = import_node_path15.default.join(componentDir, `${componentName}.stories.tsx`);
198903
- const storyExists = import_node_fs14.default.existsSync(storyPath);
198937
+ const storyExists = import_node_fs15.default.existsSync(storyPath);
198904
198938
  if (storyExists && !options.force) {
198905
198939
  throw new Error(`Story file already exists: ${storyPath}
198906
198940
  ` + `Pass --force to overwrite.`);
198907
198941
  }
198908
- import_node_fs14.default.writeFileSync(storyPath, renderStoryFile(componentName, events, payloads, { io }), "utf8");
198942
+ import_node_fs15.default.writeFileSync(storyPath, renderStoryFile(componentName, events, payloads, { io }), "utf8");
198909
198943
  console.log(`[pieui] Story ${storyExists ? "overwritten" : "created"}: ${storyPath}`);
198910
198944
  if (events.length > 0) {
198911
198945
  console.log(`[pieui] Methods wired: ${events.join(", ")}`);
@@ -198940,7 +198974,7 @@ var cardAddStoryCommand = (componentName, options = {}) => {
198940
198974
  };
198941
198975
 
198942
198976
  // src/code/commands/cardGeneratePreview.ts
198943
- var import_node_fs15 = __toESM(require("node:fs"));
198977
+ var import_node_fs16 = __toESM(require("node:fs"));
198944
198978
  var import_node_http = __toESM(require("node:http"));
198945
198979
  var import_node_os = __toESM(require("node:os"));
198946
198980
  var import_node_path16 = __toESM(require("node:path"));
@@ -198984,16 +199018,16 @@ var cardGeneratePreviewCommand = async (componentName, options = {}) => {
198984
199018
  }
198985
199019
  const settings = loadSettings();
198986
199020
  const componentDir = import_node_path16.default.join(settings.componentsDir, componentName);
198987
- if (!import_node_fs15.default.existsSync(componentDir)) {
199021
+ if (!import_node_fs16.default.existsSync(componentDir)) {
198988
199022
  throw new Error(`Component directory not found: ${componentDir}`);
198989
199023
  }
198990
199024
  const storyPath = import_node_path16.default.join(componentDir, `${componentName}.stories.tsx`);
198991
- if (!import_node_fs15.default.existsSync(storyPath)) {
199025
+ if (!import_node_fs16.default.existsSync(storyPath)) {
198992
199026
  throw new Error(`Story file not found: ${storyPath}
198993
199027
  ` + `Run \`pieui card add-story ${componentName}\` first.`);
198994
199028
  }
198995
199029
  const outPath = import_node_path16.default.resolve(process.cwd(), options.out || import_node_path16.default.join(componentDir, "preview.png"));
198996
- import_node_fs15.default.mkdirSync(import_node_path16.default.dirname(outPath), { recursive: true });
199030
+ import_node_fs16.default.mkdirSync(import_node_path16.default.dirname(outPath), { recursive: true });
198997
199031
  const bunBin = process.env.PIEUI_CREATE_BUN_BIN || "bun";
198998
199032
  let sbProc = null;
198999
199033
  const alreadyRunning = await isStorybookReachable(STORYBOOK_PORT);
@@ -199015,7 +199049,7 @@ var cardGeneratePreviewCommand = async (componentName, options = {}) => {
199015
199049
  } else {
199016
199050
  console.log(`[pieui] Using running Storybook on :${STORYBOOK_PORT}`);
199017
199051
  }
199018
- const tmpDir = import_node_fs15.default.mkdtempSync(import_node_path16.default.join(import_node_os.default.tmpdir(), "pieui-storycap-"));
199052
+ const tmpDir = import_node_fs16.default.mkdtempSync(import_node_path16.default.join(import_node_os.default.tmpdir(), "pieui-storycap-"));
199019
199053
  try {
199020
199054
  const include = `${STORY_TITLE_NAMESPACE}/${componentName}/*`;
199021
199055
  console.log(`[pieui] Running storycap for "${include}"...`);
@@ -199041,19 +199075,19 @@ var cardGeneratePreviewCommand = async (componentName, options = {}) => {
199041
199075
  throw new Error(`storycap exited with code ${result.status ?? "unknown"}`);
199042
199076
  }
199043
199077
  const producedDir = import_node_path16.default.join(tmpDir, STORY_TITLE_NAMESPACE, componentName);
199044
- if (!import_node_fs15.default.existsSync(producedDir)) {
199078
+ if (!import_node_fs16.default.existsSync(producedDir)) {
199045
199079
  throw new Error(`storycap finished but no PNGs were produced under ${producedDir}
199046
- ` + `Tmp listing: ${import_node_fs15.default.readdirSync(tmpDir).join(", ") || "(empty)"}`);
199080
+ ` + `Tmp listing: ${import_node_fs16.default.readdirSync(tmpDir).join(", ") || "(empty)"}`);
199047
199081
  }
199048
- const pngs = import_node_fs15.default.readdirSync(producedDir).filter((f) => f.endsWith(".png")).sort();
199082
+ const pngs = import_node_fs16.default.readdirSync(producedDir).filter((f) => f.endsWith(".png")).sort();
199049
199083
  if (pngs.length === 0) {
199050
199084
  throw new Error(`No PNGs in ${producedDir}`);
199051
199085
  }
199052
199086
  const picked = import_node_path16.default.join(producedDir, pngs[0]);
199053
- import_node_fs15.default.copyFileSync(picked, outPath);
199087
+ import_node_fs16.default.copyFileSync(picked, outPath);
199054
199088
  console.log(`[pieui] Preview written: ${outPath}` + (pngs.length > 1 ? ` (picked ${pngs[0]}; other states available: ${pngs.slice(1).join(", ")})` : ""));
199055
199089
  } finally {
199056
- import_node_fs15.default.rmSync(tmpDir, { recursive: true, force: true });
199090
+ import_node_fs16.default.rmSync(tmpDir, { recursive: true, force: true });
199057
199091
  if (sbProc) {
199058
199092
  killProcessTree(sbProc);
199059
199093
  console.log("[pieui] Storybook stopped");
@@ -199062,7 +199096,7 @@ var cardGeneratePreviewCommand = async (componentName, options = {}) => {
199062
199096
  };
199063
199097
 
199064
199098
  // src/code/commands/cardAddFromMeta.ts
199065
- var import_node_fs16 = __toESM(require("node:fs"));
199099
+ var import_node_fs17 = __toESM(require("node:fs"));
199066
199100
  var import_node_path17 = __toESM(require("node:path"));
199067
199101
  var import_node_child_process4 = require("node:child_process");
199068
199102
 
@@ -199145,10 +199179,10 @@ var jsonSchemaToTsType = (schema) => renderType(asSchema(schema), 0);
199145
199179
  var PIE_CONFIG_PATH = ".pie/config.json";
199146
199180
  var readBackendConfig = () => {
199147
199181
  const configPath = import_node_path17.default.join(process.cwd(), PIE_CONFIG_PATH);
199148
- if (!import_node_fs16.default.existsSync(configPath))
199182
+ if (!import_node_fs17.default.existsSync(configPath))
199149
199183
  return null;
199150
199184
  try {
199151
- const parsed = JSON.parse(import_node_fs16.default.readFileSync(configPath, "utf8"));
199185
+ const parsed = JSON.parse(import_node_fs17.default.readFileSync(configPath, "utf8"));
199152
199186
  if (typeof parsed !== "object" || parsed === null)
199153
199187
  return null;
199154
199188
  return parsed;
@@ -199165,8 +199199,8 @@ var cardNameToClassFilename = (name) => {
199165
199199
  return snake.endsWith("_card") ? `${snake}.py` : `${snake}_card.py`;
199166
199200
  };
199167
199201
  var resolveSource = (fromRaw, cardName, cfg) => {
199168
- if (fromRaw && import_node_fs16.default.existsSync(fromRaw)) {
199169
- const stat = import_node_fs16.default.statSync(fromRaw);
199202
+ if (fromRaw && import_node_fs17.default.existsSync(fromRaw)) {
199203
+ const stat = import_node_fs17.default.statSync(fromRaw);
199170
199204
  const abs = import_node_path17.default.resolve(fromRaw);
199171
199205
  if (stat.isFile() && abs.endsWith(".json")) {
199172
199206
  return { kind: "json-file", path: abs };
@@ -199216,7 +199250,7 @@ var unwrapTypescriptEnvelope2 = (parsed) => {
199216
199250
  };
199217
199251
  var fetchMetadata = (source) => {
199218
199252
  if (source.kind === "json-file") {
199219
- const raw = import_node_fs16.default.readFileSync(source.path, "utf8");
199253
+ const raw = import_node_fs17.default.readFileSync(source.path, "utf8");
199220
199254
  return unwrapTypescriptEnvelope2(JSON.parse(raw));
199221
199255
  }
199222
199256
  console.log(`[pieui] Invoking: pie card dump-metadata ${source.cardName} (cwd: ${source.backendRoot})`);
@@ -199352,10 +199386,10 @@ var renderUI = (componentName, meta, inputInterfaceName) => {
199352
199386
  };
199353
199387
  var updateRegistryFile2 = (componentsDir, componentName) => {
199354
199388
  const registryPath = resolveRegistryPath(componentsDir);
199355
- if (!import_node_fs16.default.existsSync(registryPath)) {
199389
+ if (!import_node_fs17.default.existsSync(registryPath)) {
199356
199390
  throw new Error('registry.ts not found. Run "pieui init" first.');
199357
199391
  }
199358
- let registryContent = import_node_fs16.default.readFileSync(registryPath, "utf8");
199392
+ let registryContent = import_node_fs17.default.readFileSync(registryPath, "utf8");
199359
199393
  const importRegex = new RegExp(`["']@/piecomponents/${componentName}["']`);
199360
199394
  if (importRegex.test(registryContent)) {
199361
199395
  throw new Error(`Component ${componentName} is already registered in registry.ts`);
@@ -199364,17 +199398,17 @@ var updateRegistryFile2 = (componentsDir, componentName) => {
199364
199398
  registryContent = registryContent.trimEnd() + `
199365
199399
  ` + importLine + `
199366
199400
  `;
199367
- import_node_fs16.default.writeFileSync(registryPath, registryContent, "utf8");
199401
+ import_node_fs17.default.writeFileSync(registryPath, registryContent, "utf8");
199368
199402
  };
199369
199403
  var hasBackendSourceFor = (componentName) => {
199370
199404
  const cfg = readBackendConfig();
199371
199405
  if (!cfg?.backendComponentsDir)
199372
199406
  return false;
199373
199407
  const componentsDir = import_node_path17.default.resolve(cfg.backendComponentsDir);
199374
- if (!import_node_fs16.default.existsSync(componentsDir))
199408
+ if (!import_node_fs17.default.existsSync(componentsDir))
199375
199409
  return false;
199376
199410
  const candidate = import_node_path17.default.join(componentsDir, cardNameToClassFilename(componentName));
199377
- return import_node_fs16.default.existsSync(candidate);
199411
+ return import_node_fs17.default.existsSync(candidate);
199378
199412
  };
199379
199413
  var cardAddFromMetaCommand = (componentName, componentType, fromRaw) => {
199380
199414
  if (!componentName) {
@@ -199387,7 +199421,7 @@ var cardAddFromMetaCommand = (componentName, componentType, fromRaw) => {
199387
199421
  const source = resolveSource(fromRaw, componentName, cfg);
199388
199422
  if (source.kind === "name") {
199389
199423
  const candidate = import_node_path17.default.join(source.backendRoot, import_node_path17.default.basename(import_node_path17.default.resolve(cfg.backendComponentsDir)), cardNameToClassFilename(source.cardName));
199390
- if (!import_node_fs16.default.existsSync(candidate)) {
199424
+ if (!import_node_fs17.default.existsSync(candidate)) {
199391
199425
  console.warn(`[pieui] Note: expected backend file ${candidate} not found; relying on pie's resolution`);
199392
199426
  }
199393
199427
  }
@@ -199396,22 +199430,22 @@ var cardAddFromMetaCommand = (componentName, componentType, fromRaw) => {
199396
199430
  const dataInterfaceName = extractTypeName(meta.propsCode) || `${componentName}Data`;
199397
199431
  const inputInterfaceName = meta.inputPropsCode ? extractTypeName(meta.inputPropsCode) || `${componentName}StoredInput` : null;
199398
199432
  const pieComponentsDir = import_node_path17.default.join(process.cwd(), "piecomponents");
199399
- if (!import_node_fs16.default.existsSync(pieComponentsDir)) {
199433
+ if (!import_node_fs17.default.existsSync(pieComponentsDir)) {
199400
199434
  throw new Error('piecomponents directory not found. Run "pieui init" first.');
199401
199435
  }
199402
199436
  const componentDir = import_node_path17.default.join(pieComponentsDir, componentName);
199403
- if (import_node_fs16.default.existsSync(componentDir)) {
199437
+ if (import_node_fs17.default.existsSync(componentDir)) {
199404
199438
  throw new Error(`Component ${componentName} already exists`);
199405
199439
  }
199406
199440
  try {
199407
- import_node_fs16.default.mkdirSync(import_node_path17.default.join(componentDir, "ui"), { recursive: true });
199408
- import_node_fs16.default.mkdirSync(import_node_path17.default.join(componentDir, "types"), { recursive: true });
199409
- import_node_fs16.default.writeFileSync(import_node_path17.default.join(componentDir, "index.ts"), componentIndexTemplate(componentName), "utf8");
199410
- import_node_fs16.default.writeFileSync(import_node_path17.default.join(componentDir, "types", "index.ts"), renderTypes(componentName, componentType, meta, dataInterfaceName, inputInterfaceName), "utf8");
199411
- import_node_fs16.default.writeFileSync(import_node_path17.default.join(componentDir, "ui", `${componentName}.tsx`), renderUI(componentName, meta, inputInterfaceName), "utf8");
199441
+ import_node_fs17.default.mkdirSync(import_node_path17.default.join(componentDir, "ui"), { recursive: true });
199442
+ import_node_fs17.default.mkdirSync(import_node_path17.default.join(componentDir, "types"), { recursive: true });
199443
+ import_node_fs17.default.writeFileSync(import_node_path17.default.join(componentDir, "index.ts"), componentIndexTemplate(componentName), "utf8");
199444
+ import_node_fs17.default.writeFileSync(import_node_path17.default.join(componentDir, "types", "index.ts"), renderTypes(componentName, componentType, meta, dataInterfaceName, inputInterfaceName), "utf8");
199445
+ import_node_fs17.default.writeFileSync(import_node_path17.default.join(componentDir, "ui", `${componentName}.tsx`), renderUI(componentName, meta, inputInterfaceName), "utf8");
199412
199446
  updateRegistryFile2(pieComponentsDir, componentName);
199413
199447
  } catch (error) {
199414
- import_node_fs16.default.rmSync(componentDir, { recursive: true, force: true });
199448
+ import_node_fs17.default.rmSync(componentDir, { recursive: true, force: true });
199415
199449
  throw error;
199416
199450
  }
199417
199451
  console.log(`[pieui] Component ${componentName} ported from backend successfully`);
@@ -199478,7 +199512,7 @@ var pageAddCommand = (pagePath) => {
199478
199512
  };
199479
199513
 
199480
199514
  // src/code/commands/pageView.ts
199481
- var import_node_fs17 = __toESM(require("node:fs"));
199515
+ var import_node_fs18 = __toESM(require("node:fs"));
199482
199516
  var import_node_path18 = __toESM(require("node:path"));
199483
199517
  var normalizePagePath2 = (pagePath) => {
199484
199518
  const trimmed = pagePath.trim();
@@ -199500,10 +199534,10 @@ var normalizePagePath2 = (pagePath) => {
199500
199534
  var pageViewCommand = (pagePath) => {
199501
199535
  const normalized = normalizePagePath2(pagePath);
199502
199536
  const target = import_node_path18.default.join(process.cwd(), "app", normalized, "page.tsx");
199503
- if (!import_node_fs17.default.existsSync(target)) {
199537
+ if (!import_node_fs18.default.existsSync(target)) {
199504
199538
  throw new Error(`Page file not found: ${target}`);
199505
199539
  }
199506
- const source = import_node_fs17.default.readFileSync(target, "utf8");
199540
+ const source = import_node_fs18.default.readFileSync(target, "utf8");
199507
199541
  console.log(`[pieui] Path: ${target}`);
199508
199542
  console.log("");
199509
199543
  process.stdout.write(source);
@@ -199513,23 +199547,23 @@ var pageViewCommand = (pagePath) => {
199513
199547
  };
199514
199548
 
199515
199549
  // src/code/commands/pageAjax.ts
199516
- var import_node_fs18 = __toESM(require("node:fs"));
199550
+ var import_node_fs19 = __toESM(require("node:fs"));
199517
199551
  var import_node_path19 = __toESM(require("node:path"));
199518
199552
  var import_node_child_process5 = require("node:child_process");
199519
199553
  var PIE_CONFIG_PATH2 = ".pie/config.json";
199520
199554
  var readBackendRoot = () => {
199521
199555
  const configPath = import_node_path19.default.join(process.cwd(), PIE_CONFIG_PATH2);
199522
- if (!import_node_fs18.default.existsSync(configPath))
199556
+ if (!import_node_fs19.default.existsSync(configPath))
199523
199557
  return;
199524
199558
  try {
199525
- const parsed = JSON.parse(import_node_fs18.default.readFileSync(configPath, "utf8"));
199559
+ const parsed = JSON.parse(import_node_fs19.default.readFileSync(configPath, "utf8"));
199526
199560
  if (typeof parsed !== "object" || parsed === null)
199527
199561
  return;
199528
199562
  const config = parsed;
199529
199563
  if (!config.backendPagesDir)
199530
199564
  return;
199531
199565
  const pages = import_node_path19.default.resolve(config.backendPagesDir);
199532
- if (!import_node_fs18.default.existsSync(pages) || !import_node_fs18.default.statSync(pages).isDirectory()) {
199566
+ if (!import_node_fs19.default.existsSync(pages) || !import_node_fs19.default.statSync(pages).isDirectory()) {
199533
199567
  return;
199534
199568
  }
199535
199569
  return import_node_path19.default.dirname(pages);
@@ -199559,17 +199593,17 @@ var pageAjaxCommand = (pageName, action, handlerName) => {
199559
199593
  };
199560
199594
 
199561
199595
  // src/code/commands/registry.ts
199562
- var import_node_fs19 = __toESM(require("node:fs"));
199596
+ var import_node_fs20 = __toESM(require("node:fs"));
199563
199597
  var import_node_path20 = __toESM(require("node:path"));
199564
199598
  var import_node_child_process6 = require("node:child_process");
199565
199599
  var REGISTRY_DIR = ".pie/registry";
199566
199600
  var OUT_DIRNAME = "out";
199567
199601
  var writeIfChanged = (filePath, contents) => {
199568
- if (import_node_fs19.default.existsSync(filePath) && import_node_fs19.default.readFileSync(filePath, "utf8") === contents) {
199602
+ if (import_node_fs20.default.existsSync(filePath) && import_node_fs20.default.readFileSync(filePath, "utf8") === contents) {
199569
199603
  return;
199570
199604
  }
199571
- import_node_fs19.default.mkdirSync(import_node_path20.default.dirname(filePath), { recursive: true });
199572
- import_node_fs19.default.writeFileSync(filePath, contents, "utf8");
199605
+ import_node_fs20.default.mkdirSync(import_node_path20.default.dirname(filePath), { recursive: true });
199606
+ import_node_fs20.default.writeFileSync(filePath, contents, "utf8");
199573
199607
  };
199574
199608
  var scaffoldHarness = (frontendRoot, registryName) => {
199575
199609
  const dir = import_node_path20.default.join(frontendRoot, REGISTRY_DIR);
@@ -199701,7 +199735,7 @@ export default function PreviewClient() {
199701
199735
  };
199702
199736
  var resolveNextBin = (frontendRoot) => {
199703
199737
  const bin = import_node_path20.default.join(frontendRoot, "node_modules", ".bin", "next");
199704
- if (!import_node_fs19.default.existsSync(bin)) {
199738
+ if (!import_node_fs20.default.existsSync(bin)) {
199705
199739
  throw new Error(`Next.js binary not found at ${bin}. Install dependencies in the ` + `frontend project first (the registry harness reuses them).`);
199706
199740
  }
199707
199741
  return bin;
@@ -200112,11 +200146,11 @@ var createPieAppCommand = (appName) => {
200112
200146
  // src/code/commands/login.ts
200113
200147
  var import_node_child_process7 = require("node:child_process");
200114
200148
  var import_node_crypto = require("node:crypto");
200115
- var import_node_fs21 = __toESM(require("node:fs"));
200149
+ var import_node_fs22 = __toESM(require("node:fs"));
200116
200150
  var import_node_path22 = __toESM(require("node:path"));
200117
200151
 
200118
200152
  // src/code/services/projectLinks.ts
200119
- var import_node_fs20 = __toESM(require("node:fs"));
200153
+ var import_node_fs21 = __toESM(require("node:fs"));
200120
200154
  var import_node_path21 = __toESM(require("node:path"));
200121
200155
  var readline3 = __toESM(require("node:readline/promises"));
200122
200156
  var PIE_CONFIG_DIR3 = ".pie";
@@ -200124,10 +200158,10 @@ var PIE_CONFIG_FILE3 = "config.json";
200124
200158
  var configPathFor = (cwd) => import_node_path21.default.join(cwd, PIE_CONFIG_DIR3, PIE_CONFIG_FILE3);
200125
200159
  var readConfig2 = (cwd) => {
200126
200160
  const p = configPathFor(cwd);
200127
- if (!import_node_fs20.default.existsSync(p))
200161
+ if (!import_node_fs21.default.existsSync(p))
200128
200162
  return {};
200129
200163
  try {
200130
- const parsed = JSON.parse(import_node_fs20.default.readFileSync(p, "utf8"));
200164
+ const parsed = JSON.parse(import_node_fs21.default.readFileSync(p, "utf8"));
200131
200165
  return typeof parsed === "object" && parsed !== null && !Array.isArray(parsed) ? parsed : {};
200132
200166
  } catch {
200133
200167
  return {};
@@ -200135,14 +200169,14 @@ var readConfig2 = (cwd) => {
200135
200169
  };
200136
200170
  var writeConfig2 = (cwd, config) => {
200137
200171
  const dir = import_node_path21.default.join(cwd, PIE_CONFIG_DIR3);
200138
- import_node_fs20.default.mkdirSync(dir, { recursive: true });
200139
- import_node_fs20.default.writeFileSync(configPathFor(cwd), JSON.stringify(config, null, 2) + `
200172
+ import_node_fs21.default.mkdirSync(dir, { recursive: true });
200173
+ import_node_fs21.default.writeFileSync(configPathFor(cwd), JSON.stringify(config, null, 2) + `
200140
200174
  `, "utf8");
200141
200175
  };
200142
200176
  var walkUpForPyproject2 = (start) => {
200143
200177
  let dir = import_node_path21.default.resolve(start);
200144
200178
  while (dir !== import_node_path21.default.dirname(dir)) {
200145
- if (import_node_fs20.default.existsSync(import_node_path21.default.join(dir, "pyproject.toml")))
200179
+ if (import_node_fs21.default.existsSync(import_node_path21.default.join(dir, "pyproject.toml")))
200146
200180
  return dir;
200147
200181
  dir = import_node_path21.default.dirname(dir);
200148
200182
  }
@@ -200152,7 +200186,7 @@ var ensureBackendDir2 = async (cwd) => {
200152
200186
  const config = readConfig2(cwd);
200153
200187
  if (config.backendProjectDir) {
200154
200188
  const dir = import_node_path21.default.resolve(cwd, config.backendProjectDir);
200155
- if (import_node_fs20.default.existsSync(dir) && import_node_fs20.default.statSync(dir).isDirectory())
200189
+ if (import_node_fs21.default.existsSync(dir) && import_node_fs21.default.statSync(dir).isDirectory())
200156
200190
  return dir;
200157
200191
  console.error(`[pieui] Configured backendProjectDir not found: ${dir}`);
200158
200192
  }
@@ -200179,7 +200213,7 @@ var ensureBackendDir2 = async (cwd) => {
200179
200213
  return null;
200180
200214
  const expanded = raw.startsWith("~") ? import_node_path21.default.join(process.env.HOME || "", raw.slice(1).replace(/^[\\/]/, "")) : raw;
200181
200215
  const absolute = import_node_path21.default.resolve(expanded);
200182
- if (!import_node_fs20.default.existsSync(absolute) || !import_node_fs20.default.statSync(absolute).isDirectory()) {
200216
+ if (!import_node_fs21.default.existsSync(absolute) || !import_node_fs21.default.statSync(absolute).isDirectory()) {
200183
200217
  console.error(`[pieui] Not a directory: ${absolute}`);
200184
200218
  return null;
200185
200219
  }
@@ -200249,7 +200283,7 @@ var appendPieCredentialsToEnv = (cwd, config) => {
200249
200283
  return;
200250
200284
  }
200251
200285
  const envPath = import_node_path22.default.join(cwd, ".env");
200252
- let content = import_node_fs21.default.existsSync(envPath) ? import_node_fs21.default.readFileSync(envPath, "utf8") : "";
200286
+ let content = import_node_fs22.default.existsSync(envPath) ? import_node_fs22.default.readFileSync(envPath, "utf8") : "";
200253
200287
  if (content.length > 0 && !content.endsWith(`
200254
200288
  `)) {
200255
200289
  content += `
@@ -200259,7 +200293,7 @@ var appendPieCredentialsToEnv = (cwd, config) => {
200259
200293
  content += `${additions.join(`
200260
200294
  `)}
200261
200295
  `;
200262
- import_node_fs21.default.writeFileSync(envPath, content, "utf8");
200296
+ import_node_fs22.default.writeFileSync(envPath, content, "utf8");
200263
200297
  console.log(`[pie] Appended credentials to ${envPath}`);
200264
200298
  };
200265
200299
  async function loginCommand(options = {}) {
@@ -200315,7 +200349,7 @@ async function loginCommand(options = {}) {
200315
200349
  throw new Error("Login succeeded but response had no 'config' field");
200316
200350
  }
200317
200351
  const credBlob = typeof record.config === "object" && record.config !== null && !Array.isArray(record.config) ? record.config : {};
200318
- import_node_fs21.default.mkdirSync(pieDir, { recursive: true });
200352
+ import_node_fs22.default.mkdirSync(pieDir, { recursive: true });
200319
200353
  mergeConfig(cwd, credBlob);
200320
200354
  console.log(`[pie] Saved credentials to ${configPath}`);
200321
200355
  appendPieCredentialsToEnv(cwd, record.config);
@@ -200331,7 +200365,7 @@ async function loginCommand(options = {}) {
200331
200365
 
200332
200366
  // src/code/commands/selfUpgrade.ts
200333
200367
  var import_node_child_process8 = require("node:child_process");
200334
- var import_node_fs22 = __toESM(require("node:fs"));
200368
+ var import_node_fs23 = __toESM(require("node:fs"));
200335
200369
  var import_node_path23 = __toESM(require("node:path"));
200336
200370
  var __dirname = "/home/runner/work/pieui/pieui/src/code/commands";
200337
200371
  var PACKAGE_NAME = "@swarm.ing/pieui";
@@ -200362,7 +200396,7 @@ var readInstalledVersion = () => {
200362
200396
  ];
200363
200397
  for (const file of candidates) {
200364
200398
  try {
200365
- const raw = import_node_fs22.default.readFileSync(file, "utf8");
200399
+ const raw = import_node_fs23.default.readFileSync(file, "utf8");
200366
200400
  const parsed = JSON.parse(raw);
200367
200401
  if (parsed.name === PACKAGE_NAME && parsed.version) {
200368
200402
  return parsed.version;
@@ -1 +1 @@
1
- {"version":3,"file":"schemaContext.d.ts","sourceRoot":"","sources":["../../../src/code/introspection/schemaContext.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAKH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAE1C,MAAM,MAAM,aAAa,GAAG;IACxB,OAAO,EAAE,GAAG,CAAA;IACZ,OAAO,EAAE,GAAG,CAAA;IACZ,SAAS,EAAE,GAAG,CAAA;CACjB,CAAA;AAaD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,mBAAmB,GAAI,OAAO,MAAM,EAAE,KAAG,aA2BrD,CAAA;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,mBAAmB,GAC5B,SAAS,GAAG,EACZ,SAAS,GAAG,EACZ,UAAU,MAAM,KACjB;IAAE,MAAM,EAAE,GAAG,CAAC;IAAC,WAAW,EAAE,GAAG,CAAA;CAAE,GAAG,IAuBtC,CAAA;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,kBAAkB,GAC3B,KAAK,aAAa,EAClB,UAAU,MAAM,KACjB,UAAU,GAAG,IAiBf,CAAA"}
1
+ {"version":3,"file":"schemaContext.d.ts","sourceRoot":"","sources":["../../../src/code/introspection/schemaContext.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAMH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAE1C,MAAM,MAAM,aAAa,GAAG;IACxB,OAAO,EAAE,GAAG,CAAA;IACZ,OAAO,EAAE,GAAG,CAAA;IACZ,SAAS,EAAE,GAAG,CAAA;CACjB,CAAA;AAqDD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,mBAAmB,GAAI,OAAO,MAAM,EAAE,KAAG,aA4BrD,CAAA;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,mBAAmB,GAC5B,SAAS,GAAG,EACZ,SAAS,GAAG,EACZ,UAAU,MAAM,KACjB;IAAE,MAAM,EAAE,GAAG,CAAC;IAAC,WAAW,EAAE,GAAG,CAAA;CAAE,GAAG,IAuBtC,CAAA;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,kBAAkB,GAC3B,KAAK,aAAa,EAClB,UAAU,MAAM,KACjB,UAAU,GAAG,IAiBf,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"schemaPatch.d.ts","sourceRoot":"","sources":["../../../src/code/introspection/schemaPatch.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,mBAAmB,GAAI,MAAM,GAAG,EAAE,SAAS,GAAG,KAAG,OAmC7D,CAAA;AAED,eAAO,MAAM,kBAAkB,GAC3B,MAAM,GAAG,EACT,SAAS,GAAG,KACb,MAAM,CAAC,MAAM,EAAE,GAAG,CA4CpB,CAAA;AAED,eAAO,MAAM,kBAAkB,GAC3B,MAAM,GAAG,EACT,QAAQ,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC3B,SAAS,GAAG,EACZ,UAAS,GAAG,CAAC,MAAM,CAAa,KACjC,IA6GF,CAAA"}
1
+ {"version":3,"file":"schemaPatch.d.ts","sourceRoot":"","sources":["../../../src/code/introspection/schemaPatch.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,mBAAmB,GAAI,MAAM,GAAG,EAAE,SAAS,GAAG,KAAG,OAmC7D,CAAA;AAED,eAAO,MAAM,kBAAkB,GAC3B,MAAM,GAAG,EACT,SAAS,GAAG,KACb,MAAM,CAAC,MAAM,EAAE,GAAG,CA4CpB,CAAA;AAED,eAAO,MAAM,kBAAkB,GAC3B,MAAM,GAAG,EACT,QAAQ,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC3B,SAAS,GAAG,EACZ,UAAS,GAAG,CAAC,MAAM,CAAa,KACjC,IAiHF,CAAA"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * A card whose props type imports a value object through a tsconfig path alias
3
+ * (e.g. `@/piecomponents/Shared/types`) must resolve to a typed schema — not
4
+ * degrade to `{ type: 'object' }`.
5
+ *
6
+ * Regression: schema generation built the TS program without the project's
7
+ * `baseUrl`/`paths`, so alias imports never resolved, the imported file never
8
+ * entered the program, and `HoldingRefData[]` collapsed to `object`. This broke
9
+ * cross-side `check-sync` (Python array ↔ TS object).
10
+ */
11
+ export {};
12
+ //# sourceMappingURL=schemaAliasImports.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemaAliasImports.test.d.ts","sourceRoot":"","sources":["../../src/tests/schemaAliasImports.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swarm.ing/pieui",
3
- "version": "3.0.1",
3
+ "version": "3.0.3",
4
4
  "description": "A React component library featuring PieCard component",
5
5
  "repository": {
6
6
  "type": "git",