@swarm.ing/pieui 3.0.9 → 3.0.11

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
@@ -175823,6 +175823,7 @@ var require_tsconfig4 = __commonJS((exports2, module2) => {
175823
175823
  lib: ["es2018"],
175824
175824
  module: "commonjs",
175825
175825
  target: "es2018",
175826
+ types: ["node"],
175826
175827
  strict: true,
175827
175828
  esModuleInterop: true,
175828
175829
  skipLibCheck: true,
@@ -177609,6 +177610,7 @@ var require_acorn = __commonJS((exports2, module2) => {
177609
177610
  allowHashBang: false,
177610
177611
  checkPrivateFields: true,
177611
177612
  locations: false,
177613
+ startLocation: null,
177612
177614
  onToken: null,
177613
177615
  onComment: null,
177614
177616
  ranges: false,
@@ -177694,14 +177696,19 @@ Defaulting to 2020, but this will stop working in the future.`);
177694
177696
  this.reservedWordsStrictBind = wordsRegexp(reservedStrict + " " + reservedWords.strictBind);
177695
177697
  this.input = String(input);
177696
177698
  this.containsEsc = false;
177697
- if (startPos) {
177698
- this.pos = startPos;
177699
+ this.pos = startPos || 0;
177700
+ this.curLine = 1;
177701
+ if (options.startLocation) {
177702
+ this.lineStart = this.pos - options.startLocation.column;
177703
+ this.curLine = options.startLocation.line;
177704
+ } else if (startPos) {
177699
177705
  this.lineStart = this.input.lastIndexOf(`
177700
177706
  `, startPos - 1) + 1;
177701
- this.curLine = this.input.slice(0, this.lineStart).split(lineBreak).length;
177707
+ if (this.options.locations) {
177708
+ this.curLine = this.input.slice(0, this.lineStart).split(lineBreak).length;
177709
+ }
177702
177710
  } else {
177703
- this.pos = this.lineStart = 0;
177704
- this.curLine = 1;
177711
+ this.lineStart = 0;
177705
177712
  }
177706
177713
  this.type = types$1.eof;
177707
177714
  this.value = null;
@@ -179728,7 +179735,7 @@ Defaulting to 2020, but this will stop working in the future.`);
179728
179735
  expr = this.finishNode(node$1, "UpdateExpression");
179729
179736
  }
179730
179737
  }
179731
- if (!incDec && this.eat(types$1.starstar)) {
179738
+ if (!incDec && !(expr.type === "ArrowFunctionExpression" && expr.start === startPos) && this.eat(types$1.starstar)) {
179732
179739
  if (sawUnary) {
179733
179740
  this.unexpected(this.lastTokStart);
179734
179741
  } else {
@@ -182647,7 +182654,7 @@ Defaulting to 2020, but this will stop working in the future.`);
182647
182654
  }
182648
182655
  return this.finishToken(type, word);
182649
182656
  };
182650
- var version = "8.17.0";
182657
+ var version = "8.18.0";
182651
182658
  Parser.acorn = {
182652
182659
  Parser,
182653
182660
  version,
@@ -185671,9 +185678,11 @@ var require_sourcemap_codec_umd = __commonJS((exports2, module2) => {
185671
185678
  decode: () => decode,
185672
185679
  decodeGeneratedRanges: () => decodeGeneratedRanges,
185673
185680
  decodeOriginalScopes: () => decodeOriginalScopes,
185681
+ decodeRangeMappings: () => decodeRangeMappings,
185674
185682
  encode: () => encode,
185675
185683
  encodeGeneratedRanges: () => encodeGeneratedRanges,
185676
- encodeOriginalScopes: () => encodeOriginalScopes
185684
+ encodeOriginalScopes: () => encodeOriginalScopes,
185685
+ encodeRangeMappings: () => encodeRangeMappings
185677
185686
  });
185678
185687
  module3.exports = __toCommonJS(sourcemap_codec_exports);
185679
185688
  var comma = 44;
@@ -185686,7 +185695,7 @@ var require_sourcemap_codec_umd = __commonJS((exports2, module2) => {
185686
185695
  intToChar[i] = c;
185687
185696
  charToInt[c] = i;
185688
185697
  }
185689
- function decodeInteger(reader, relative) {
185698
+ function decodeInteger(reader) {
185690
185699
  let value2 = 0;
185691
185700
  let shift = 0;
185692
185701
  let integer = 0;
@@ -185696,24 +185705,22 @@ var require_sourcemap_codec_umd = __commonJS((exports2, module2) => {
185696
185705
  value2 |= (integer & 31) << shift;
185697
185706
  shift += 5;
185698
185707
  } while (integer & 32);
185699
- const shouldNegate = value2 & 1;
185700
- value2 >>>= 1;
185701
- if (shouldNegate) {
185702
- value2 = -2147483648 | -value2;
185703
- }
185704
- return relative + value2;
185708
+ return value2;
185709
+ }
185710
+ function decodeSign(num) {
185711
+ return num & 1 ? -2147483648 | -(num >>> 1) : num >>> 1;
185705
185712
  }
185706
- function encodeInteger(builder, num, relative) {
185707
- let delta = num - relative;
185708
- delta = delta < 0 ? -delta << 1 | 1 : delta << 1;
185713
+ function encodeInteger(builder, num) {
185709
185714
  do {
185710
- let clamped = delta & 31;
185711
- delta >>>= 5;
185712
- if (delta > 0)
185715
+ let clamped = num & 31;
185716
+ num >>>= 5;
185717
+ if (num > 0)
185713
185718
  clamped |= 32;
185714
185719
  builder.write(intToChar[clamped]);
185715
- } while (delta > 0);
185716
- return num;
185720
+ } while (num > 0);
185721
+ }
185722
+ function encodeSign(num) {
185723
+ return num < 0 ? -num << 1 | 1 : num << 1;
185717
185724
  }
185718
185725
  function hasMoreVlq(reader, max) {
185719
185726
  if (reader.pos >= max)
@@ -185779,23 +185786,23 @@ var require_sourcemap_codec_umd = __commonJS((exports2, module2) => {
185779
185786
  const stack = [];
185780
185787
  let line = 0;
185781
185788
  for (;reader.pos < length; reader.pos++) {
185782
- line = decodeInteger(reader, line);
185783
- const column = decodeInteger(reader, 0);
185789
+ line += decodeSign(decodeInteger(reader));
185790
+ const column = decodeSign(decodeInteger(reader));
185784
185791
  if (!hasMoreVlq(reader, length)) {
185785
185792
  const last = stack.pop();
185786
185793
  last[2] = line;
185787
185794
  last[3] = column;
185788
185795
  continue;
185789
185796
  }
185790
- const kind = decodeInteger(reader, 0);
185791
- const fields = decodeInteger(reader, 0);
185797
+ const kind = decodeSign(decodeInteger(reader));
185798
+ const fields = decodeSign(decodeInteger(reader));
185792
185799
  const hasName = fields & 1;
185793
- const scope = hasName ? [line, column, 0, 0, kind, decodeInteger(reader, 0)] : [line, column, 0, 0, kind];
185800
+ const scope = hasName ? [line, column, 0, 0, kind, decodeSign(decodeInteger(reader))] : [line, column, 0, 0, kind];
185794
185801
  let vars = EMPTY;
185795
185802
  if (hasMoreVlq(reader, length)) {
185796
185803
  vars = [];
185797
185804
  do {
185798
- const varsIndex = decodeInteger(reader, 0);
185805
+ const varsIndex = decodeSign(decodeInteger(reader));
185799
185806
  vars.push(varsIndex);
185800
185807
  } while (hasMoreVlq(reader, length));
185801
185808
  }
@@ -185817,15 +185824,16 @@ var require_sourcemap_codec_umd = __commonJS((exports2, module2) => {
185817
185824
  const { 0: startLine, 1: startColumn, 2: endLine, 3: endColumn, 4: kind, vars } = scope;
185818
185825
  if (index > 0)
185819
185826
  writer.write(comma);
185820
- state[0] = encodeInteger(writer, startLine, state[0]);
185821
- encodeInteger(writer, startColumn, 0);
185822
- encodeInteger(writer, kind, 0);
185827
+ encodeInteger(writer, encodeSign(startLine - state[0]));
185828
+ state[0] = startLine;
185829
+ encodeInteger(writer, encodeSign(startColumn));
185830
+ encodeInteger(writer, encodeSign(kind));
185823
185831
  const fields = scope.length === 6 ? 1 : 0;
185824
- encodeInteger(writer, fields, 0);
185832
+ encodeInteger(writer, encodeSign(fields));
185825
185833
  if (scope.length === 6)
185826
- encodeInteger(writer, scope[5], 0);
185834
+ encodeInteger(writer, encodeSign(scope[5]));
185827
185835
  for (const v of vars) {
185828
- encodeInteger(writer, v, 0);
185836
+ encodeInteger(writer, encodeSign(v));
185829
185837
  }
185830
185838
  for (index++;index < scopes.length; ) {
185831
185839
  const next = scopes[index];
@@ -185836,8 +185844,9 @@ var require_sourcemap_codec_umd = __commonJS((exports2, module2) => {
185836
185844
  index = _encodeOriginalScopes(scopes, index, writer, state);
185837
185845
  }
185838
185846
  writer.write(comma);
185839
- state[0] = encodeInteger(writer, endLine, state[0]);
185840
- encodeInteger(writer, endColumn, 0);
185847
+ encodeInteger(writer, encodeSign(endLine - state[0]));
185848
+ state[0] = endLine;
185849
+ encodeInteger(writer, encodeSign(endColumn));
185841
185850
  return index;
185842
185851
  }
185843
185852
  function decodeGeneratedRanges(input) {
@@ -185857,14 +185866,14 @@ var require_sourcemap_codec_umd = __commonJS((exports2, module2) => {
185857
185866
  const semi = reader.indexOf(";");
185858
185867
  let genColumn = 0;
185859
185868
  for (;reader.pos < semi; reader.pos++) {
185860
- genColumn = decodeInteger(reader, genColumn);
185869
+ genColumn += decodeSign(decodeInteger(reader));
185861
185870
  if (!hasMoreVlq(reader, semi)) {
185862
185871
  const last = stack.pop();
185863
185872
  last[2] = genLine;
185864
185873
  last[3] = genColumn;
185865
185874
  continue;
185866
185875
  }
185867
- const fields = decodeInteger(reader, 0);
185876
+ const fields = decodeSign(decodeInteger(reader));
185868
185877
  const hasDefinition = fields & 1;
185869
185878
  const hasCallsite = fields & 2;
185870
185879
  const hasScope = fields & 4;
@@ -185872,8 +185881,8 @@ var require_sourcemap_codec_umd = __commonJS((exports2, module2) => {
185872
185881
  let bindings = EMPTY;
185873
185882
  let range;
185874
185883
  if (hasDefinition) {
185875
- const defSourcesIndex = decodeInteger(reader, definitionSourcesIndex);
185876
- definitionScopeIndex = decodeInteger(reader, definitionSourcesIndex === defSourcesIndex ? definitionScopeIndex : 0);
185884
+ const defSourcesIndex = definitionSourcesIndex + decodeSign(decodeInteger(reader));
185885
+ definitionScopeIndex = decodeSign(decodeInteger(reader)) + (definitionSourcesIndex === defSourcesIndex ? definitionScopeIndex : 0);
185877
185886
  definitionSourcesIndex = defSourcesIndex;
185878
185887
  range = [genLine, genColumn, 0, 0, defSourcesIndex, definitionScopeIndex];
185879
185888
  } else {
@@ -185883,10 +185892,10 @@ var require_sourcemap_codec_umd = __commonJS((exports2, module2) => {
185883
185892
  if (hasCallsite) {
185884
185893
  const prevCsi = callsiteSourcesIndex;
185885
185894
  const prevLine = callsiteLine;
185886
- callsiteSourcesIndex = decodeInteger(reader, callsiteSourcesIndex);
185895
+ callsiteSourcesIndex += decodeSign(decodeInteger(reader));
185887
185896
  const sameSource = prevCsi === callsiteSourcesIndex;
185888
- callsiteLine = decodeInteger(reader, sameSource ? callsiteLine : 0);
185889
- callsiteColumn = decodeInteger(reader, sameSource && prevLine === callsiteLine ? callsiteColumn : 0);
185897
+ callsiteLine = (sameSource ? callsiteLine : 0) + decodeSign(decodeInteger(reader));
185898
+ callsiteColumn = (sameSource && prevLine === callsiteLine ? callsiteColumn : 0) + decodeSign(decodeInteger(reader));
185890
185899
  callsite = [callsiteSourcesIndex, callsiteLine, callsiteColumn];
185891
185900
  }
185892
185901
  range.callsite = callsite;
@@ -185895,15 +185904,15 @@ var require_sourcemap_codec_umd = __commonJS((exports2, module2) => {
185895
185904
  do {
185896
185905
  bindingLine = genLine;
185897
185906
  bindingColumn = genColumn;
185898
- const expressionsCount = decodeInteger(reader, 0);
185907
+ const expressionsCount = decodeSign(decodeInteger(reader));
185899
185908
  let expressionRanges;
185900
185909
  if (expressionsCount < -1) {
185901
- expressionRanges = [[decodeInteger(reader, 0)]];
185910
+ expressionRanges = [[decodeSign(decodeInteger(reader))]];
185902
185911
  for (let i = -1;i > expressionsCount; i--) {
185903
185912
  const prevBl = bindingLine;
185904
- bindingLine = decodeInteger(reader, bindingLine);
185905
- bindingColumn = decodeInteger(reader, bindingLine === prevBl ? bindingColumn : 0);
185906
- const expression = decodeInteger(reader, 0);
185913
+ bindingLine += decodeSign(decodeInteger(reader));
185914
+ bindingColumn = (bindingLine === prevBl ? bindingColumn : 0) + decodeSign(decodeInteger(reader));
185915
+ const expression = decodeSign(decodeInteger(reader));
185907
185916
  expressionRanges.push([expression, bindingLine, bindingColumn]);
185908
185917
  }
185909
185918
  } else {
@@ -185948,16 +185957,19 @@ var require_sourcemap_codec_umd = __commonJS((exports2, module2) => {
185948
185957
  } else if (index > 0) {
185949
185958
  writer.write(comma);
185950
185959
  }
185951
- state[1] = encodeInteger(writer, range[1], state[1]);
185960
+ encodeInteger(writer, encodeSign(range[1] - state[1]));
185961
+ state[1] = range[1];
185952
185962
  const fields = (range.length === 6 ? 1 : 0) | (callsite ? 2 : 0) | (isScope ? 4 : 0);
185953
- encodeInteger(writer, fields, 0);
185963
+ encodeInteger(writer, encodeSign(fields));
185954
185964
  if (range.length === 6) {
185955
185965
  const { 4: sourcesIndex, 5: scopesIndex } = range;
185956
185966
  if (sourcesIndex !== state[2]) {
185957
185967
  state[3] = 0;
185958
185968
  }
185959
- state[2] = encodeInteger(writer, sourcesIndex, state[2]);
185960
- state[3] = encodeInteger(writer, scopesIndex, state[3]);
185969
+ encodeInteger(writer, encodeSign(sourcesIndex - state[2]));
185970
+ state[2] = sourcesIndex;
185971
+ encodeInteger(writer, encodeSign(scopesIndex - state[3]));
185972
+ state[3] = scopesIndex;
185961
185973
  }
185962
185974
  if (callsite) {
185963
185975
  const { 0: sourcesIndex, 1: callLine, 2: callColumn } = range.callsite;
@@ -185967,23 +185979,28 @@ var require_sourcemap_codec_umd = __commonJS((exports2, module2) => {
185967
185979
  } else if (callLine !== state[5]) {
185968
185980
  state[6] = 0;
185969
185981
  }
185970
- state[4] = encodeInteger(writer, sourcesIndex, state[4]);
185971
- state[5] = encodeInteger(writer, callLine, state[5]);
185972
- state[6] = encodeInteger(writer, callColumn, state[6]);
185982
+ encodeInteger(writer, encodeSign(sourcesIndex - state[4]));
185983
+ state[4] = sourcesIndex;
185984
+ encodeInteger(writer, encodeSign(callLine - state[5]));
185985
+ state[5] = callLine;
185986
+ encodeInteger(writer, encodeSign(callColumn - state[6]));
185987
+ state[6] = callColumn;
185973
185988
  }
185974
185989
  if (bindings) {
185975
185990
  for (const binding of bindings) {
185976
185991
  if (binding.length > 1)
185977
- encodeInteger(writer, -binding.length, 0);
185992
+ encodeInteger(writer, encodeSign(-binding.length));
185978
185993
  const expression = binding[0][0];
185979
- encodeInteger(writer, expression, 0);
185994
+ encodeInteger(writer, encodeSign(expression));
185980
185995
  let bindingStartLine = startLine;
185981
185996
  let bindingStartColumn = startColumn;
185982
185997
  for (let i = 1;i < binding.length; i++) {
185983
185998
  const expRange = binding[i];
185984
- bindingStartLine = encodeInteger(writer, expRange[1], bindingStartLine);
185985
- bindingStartColumn = encodeInteger(writer, expRange[2], bindingStartColumn);
185986
- encodeInteger(writer, expRange[0], 0);
185999
+ encodeInteger(writer, encodeSign(expRange[1] - bindingStartLine));
186000
+ bindingStartLine = expRange[1];
186001
+ encodeInteger(writer, encodeSign(expRange[2] - bindingStartColumn));
186002
+ bindingStartColumn = expRange[2];
186003
+ encodeInteger(writer, encodeSign(expRange[0]));
185987
186004
  }
185988
186005
  }
185989
186006
  }
@@ -186002,7 +186019,8 @@ var require_sourcemap_codec_umd = __commonJS((exports2, module2) => {
186002
186019
  } else {
186003
186020
  writer.write(comma);
186004
186021
  }
186005
- state[1] = encodeInteger(writer, endColumn, state[1]);
186022
+ encodeInteger(writer, encodeSign(endColumn - state[1]));
186023
+ state[1] = endColumn;
186006
186024
  return index;
186007
186025
  }
186008
186026
  function catchupLine(writer, lastLine, line) {
@@ -186010,6 +186028,40 @@ var require_sourcemap_codec_umd = __commonJS((exports2, module2) => {
186010
186028
  writer.write(semicolon);
186011
186029
  } while (++lastLine < line);
186012
186030
  }
186031
+ function decodeRangeMappings(input) {
186032
+ const { length } = input;
186033
+ const reader = new StringReader(input);
186034
+ const rangeMappings = [];
186035
+ do {
186036
+ const semi = reader.indexOf(";");
186037
+ const indices = [];
186038
+ let index = 0;
186039
+ while (reader.pos < semi) {
186040
+ index += decodeInteger(reader);
186041
+ indices.push(index);
186042
+ }
186043
+ rangeMappings.push(indices);
186044
+ reader.pos = semi + 1;
186045
+ } while (reader.pos <= length);
186046
+ return rangeMappings;
186047
+ }
186048
+ function encodeRangeMappings(decoded) {
186049
+ if (decoded.length === 0)
186050
+ return "";
186051
+ const writer = new StringWriter;
186052
+ for (let i = 0;i < decoded.length; i++) {
186053
+ const indices = decoded[i];
186054
+ if (i > 0)
186055
+ writer.write(semicolon);
186056
+ let index = 0;
186057
+ for (let j = 0;j < indices.length; j++) {
186058
+ const offset = indices[j];
186059
+ encodeInteger(writer, offset - index);
186060
+ index = offset;
186061
+ }
186062
+ }
186063
+ return writer.flush();
186064
+ }
186013
186065
  function decode(mappings) {
186014
186066
  const { length } = mappings;
186015
186067
  const reader = new StringReader(mappings);
@@ -186027,16 +186079,16 @@ var require_sourcemap_codec_umd = __commonJS((exports2, module2) => {
186027
186079
  genColumn = 0;
186028
186080
  while (reader.pos < semi) {
186029
186081
  let seg;
186030
- genColumn = decodeInteger(reader, genColumn);
186082
+ genColumn += decodeSign(decodeInteger(reader));
186031
186083
  if (genColumn < lastCol)
186032
186084
  sorted = false;
186033
186085
  lastCol = genColumn;
186034
186086
  if (hasMoreVlq(reader, semi)) {
186035
- sourcesIndex = decodeInteger(reader, sourcesIndex);
186036
- sourceLine = decodeInteger(reader, sourceLine);
186037
- sourceColumn = decodeInteger(reader, sourceColumn);
186087
+ sourcesIndex += decodeSign(decodeInteger(reader));
186088
+ sourceLine += decodeSign(decodeInteger(reader));
186089
+ sourceColumn += decodeSign(decodeInteger(reader));
186038
186090
  if (hasMoreVlq(reader, semi)) {
186039
- namesIndex = decodeInteger(reader, namesIndex);
186091
+ namesIndex += decodeSign(decodeInteger(reader));
186040
186092
  seg = [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex];
186041
186093
  } else {
186042
186094
  seg = [genColumn, sourcesIndex, sourceLine, sourceColumn];
@@ -186077,15 +186129,20 @@ var require_sourcemap_codec_umd = __commonJS((exports2, module2) => {
186077
186129
  const segment = line[j];
186078
186130
  if (j > 0)
186079
186131
  writer.write(comma);
186080
- genColumn = encodeInteger(writer, segment[0], genColumn);
186132
+ encodeInteger(writer, encodeSign(segment[0] - genColumn));
186133
+ genColumn = segment[0];
186081
186134
  if (segment.length === 1)
186082
186135
  continue;
186083
- sourcesIndex = encodeInteger(writer, segment[1], sourcesIndex);
186084
- sourceLine = encodeInteger(writer, segment[2], sourceLine);
186085
- sourceColumn = encodeInteger(writer, segment[3], sourceColumn);
186136
+ encodeInteger(writer, encodeSign(segment[1] - sourcesIndex));
186137
+ encodeInteger(writer, encodeSign(segment[2] - sourceLine));
186138
+ encodeInteger(writer, encodeSign(segment[3] - sourceColumn));
186139
+ sourcesIndex = segment[1];
186140
+ sourceLine = segment[2];
186141
+ sourceColumn = segment[3];
186086
186142
  if (segment.length === 4)
186087
186143
  continue;
186088
- namesIndex = encodeInteger(writer, segment[4], namesIndex);
186144
+ encodeInteger(writer, encodeSign(segment[4] - namesIndex));
186145
+ namesIndex = segment[4];
186089
186146
  }
186090
186147
  }
186091
186148
  return writer.flush();
@@ -199740,6 +199797,53 @@ var linkPublicAssets = (frontendRoot, dir) => {
199740
199797
  console.log(`[pieui] could not link public/ into the harness (${String(error)}); ` + `static assets may 404 in the preview.`);
199741
199798
  }
199742
199799
  };
199800
+ var ENV_TEMPLATE_SUFFIXES = [".example", ".sample", ".template"];
199801
+ var linkEnvFiles = (frontendRoot, dir) => {
199802
+ const isEnvFile = (name) => (name === ".env" || name.startsWith(".env.")) && !ENV_TEMPLATE_SUFFIXES.some((suffix) => name.endsWith(suffix));
199803
+ let names = [];
199804
+ try {
199805
+ names = import_node_fs21.default.readdirSync(frontendRoot).filter(isEnvFile).sort();
199806
+ } catch {
199807
+ return [];
199808
+ }
199809
+ try {
199810
+ for (const stale of import_node_fs21.default.readdirSync(dir)) {
199811
+ if (!isEnvFile(stale) || names.includes(stale))
199812
+ continue;
199813
+ const target = import_node_path21.default.join(dir, stale);
199814
+ if (import_node_fs21.default.lstatSync(target).isSymbolicLink())
199815
+ import_node_fs21.default.rmSync(target);
199816
+ }
199817
+ } catch {}
199818
+ const linked = [];
199819
+ for (const name of names) {
199820
+ const source = import_node_path21.default.join(frontendRoot, name);
199821
+ const target = import_node_path21.default.join(dir, name);
199822
+ try {
199823
+ if (!import_node_fs21.default.statSync(source).isFile())
199824
+ continue;
199825
+ let existing = null;
199826
+ try {
199827
+ existing = import_node_fs21.default.lstatSync(target);
199828
+ } catch {
199829
+ existing = null;
199830
+ }
199831
+ if (existing) {
199832
+ if (existing.isSymbolicLink() && import_node_path21.default.resolve(dir, import_node_fs21.default.readlinkSync(target)) === source) {
199833
+ linked.push(name);
199834
+ continue;
199835
+ }
199836
+ import_node_fs21.default.rmSync(target, { recursive: true, force: true });
199837
+ }
199838
+ import_node_fs21.default.mkdirSync(dir, { recursive: true });
199839
+ import_node_fs21.default.symlinkSync(source, target, "file");
199840
+ linked.push(name);
199841
+ } catch (error) {
199842
+ console.log(`[pieui] could not link ${name} into the harness ` + `(${String(error)}); its variables stay unset in the preview.`);
199843
+ }
199844
+ }
199845
+ return linked;
199846
+ };
199743
199847
  var scaffoldHarness = (frontendRoot, registryName, hasProviders) => {
199744
199848
  const dir = import_node_path21.default.join(frontendRoot, REGISTRY_DIR);
199745
199849
  writeIfChanged(import_node_path21.default.join(dir, "package.json"), JSON.stringify({ name: "pie-registry-preview", version: "0.0.0", private: true }, null, 2) + `
@@ -199925,10 +200029,32 @@ export default function PreviewClient() {
199925
200029
  `);
199926
200030
  scaffoldTailwindV3(frontendRoot, dir);
199927
200031
  linkPublicAssets(frontendRoot, dir);
200032
+ const envFiles = linkEnvFiles(frontendRoot, dir);
200033
+ if (envFiles.length) {
200034
+ console.log(`[pieui] env: ${envFiles.join(", ")}`);
200035
+ }
199928
200036
  writeIfChanged(import_node_path21.default.join(dir, ".gitignore"), `*
199929
200037
  `);
199930
200038
  return dir;
199931
200039
  };
200040
+ var liveHarness = (dir) => {
200041
+ let lock;
200042
+ try {
200043
+ lock = JSON.parse(import_node_fs21.default.readFileSync(import_node_path21.default.join(dir, ".next", "dev", "lock"), "utf8"));
200044
+ } catch {
200045
+ return null;
200046
+ }
200047
+ const { pid, appUrl } = lock;
200048
+ if (typeof pid !== "number" || typeof appUrl !== "string")
200049
+ return null;
200050
+ try {
200051
+ process.kill(pid, 0);
200052
+ } catch (err) {
200053
+ if (err.code !== "EPERM")
200054
+ return null;
200055
+ }
200056
+ return { pid, appUrl };
200057
+ };
199932
200058
  var resolveNextBin = (frontendRoot) => {
199933
200059
  const bin = import_node_path21.default.join(frontendRoot, "node_modules", ".bin", "next");
199934
200060
  if (!import_node_fs21.default.existsSync(bin)) {
@@ -199947,15 +200073,22 @@ var registryCommand = (action, opts = {}) => {
199947
200073
  const dir = scaffoldHarness(frontendRoot, registryName, hasProviders);
199948
200074
  const nextBin = resolveNextBin(frontendRoot);
199949
200075
  const env = { ...process.env };
199950
- if (opts.apiServer) {
199951
- env.PIE_API_SERVER = opts.apiServer;
199952
- env.NEXT_PUBLIC_PIE_API_SERVER = opts.apiServer;
199953
- }
200076
+ env.PIE_API_SERVER = opts.apiServer ?? "";
200077
+ env.NEXT_PUBLIC_PIE_API_SERVER = opts.apiServer ?? "";
199954
200078
  if (action === "dev") {
200079
+ const running = liveHarness(dir);
200080
+ if (running) {
200081
+ console.error(`[pieui] a registry harness already serves ${dir}
200082
+ ` + `[pieui] url: ${running.appUrl}
200083
+ ` + `[pieui] pid: ${running.pid}
200084
+ ` + `[pieui] point the viewer at that url, or stop it first ` + `(kill ${running.pid}).`);
200085
+ process.exitCode = 1;
200086
+ return;
200087
+ }
199955
200088
  const port = opts.port ?? 3210;
199956
200089
  console.log(`[pieui] registry dev → http://localhost:${port}`);
199957
200090
  console.log(`[pieui] harness: ${dir}`);
199958
- console.log(`[pieui] PIE_API_SERVER=${env.PIE_API_SERVER ?? "(unset → /)"}`);
200091
+ console.log(`[pieui] PIE_API_SERVER=${env.PIE_API_SERVER || "(unset → /)"}`);
199959
200092
  const result2 = import_node_child_process6.spawnSync(nextBin, ["dev", "-p", String(port)], {
199960
200093
  cwd: dir,
199961
200094
  stdio: "inherit",
@@ -199968,8 +200101,8 @@ var registryCommand = (action, opts = {}) => {
199968
200101
  }
199969
200102
  return;
199970
200103
  }
199971
- delete env.PIE_API_SERVER;
199972
- delete env.NEXT_PUBLIC_PIE_API_SERVER;
200104
+ env.PIE_API_SERVER = "";
200105
+ env.NEXT_PUBLIC_PIE_API_SERVER = "";
199973
200106
  console.log(`[pieui] registry build (static export) → ${import_node_path21.default.join(dir, OUT_DIRNAME)}`);
199974
200107
  const result = import_node_child_process6.spawnSync(nextBin, ["build"], {
199975
200108
  cwd: dir,
@@ -1 +1 @@
1
- {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/code/commands/registry.ts"],"names":[],"mappings":"AAyBA,KAAK,eAAe,GAAG;IACnB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,GAAG,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AAgbD,eAAO,MAAM,eAAe,WAChB,KAAK,GAAG,OAAO,SACjB,eAAe,KACtB,IAyDF,CAAA"}
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/code/commands/registry.ts"],"names":[],"mappings":"AAyBA,KAAK,eAAe,GAAG;IACnB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,GAAG,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AAwiBD,eAAO,MAAM,eAAe,WAChB,KAAK,GAAG,OAAO,SACjB,eAAe,KACtB,IA+EF,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/PieMaxRoot/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAkB,MAAM,OAAO,CAAA;AAOtC,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAoL/C;;;;;;;;;;;GAWG;AACH,QAAA,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAetC,CAAA;eAEc,UAAU"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/PieMaxRoot/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAkB,MAAM,OAAO,CAAA;AAOtC,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAgM/C;;;;;;;;;;;GAWG;AACH,QAAA,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAetC,CAAA;eAEc,UAAU"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/PieRoot/index.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAoLtC;;;;;;;;;;;;;;;;GAgBG;AACH,QAAA,MAAM,OAAO,UAAW,YAAY,gCAmBnC,CAAA;eAEc,OAAO"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/PieRoot/index.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAmMtC;;;;;;;;;;;;;;;;GAgBG;AACH,QAAA,MAAM,OAAO,UAAW,YAAY,gCAmBnC,CAAA;eAEc,OAAO"}
@@ -2,6 +2,7 @@ import { ReactNode } from 'react';
2
2
  import { PieConfig, UIConfigType } from '../../../types';
3
3
  import { QueryClient, UseQueryOptions } from '@tanstack/react-query';
4
4
  import { AxiosError } from 'axios';
5
+ import { PieConfigPrefetch } from '../../../util/contentRequest';
5
6
  /**
6
7
  * Extra options merged into the internal `useQuery` call that fetches the
7
8
  * UI configuration. `queryKey`, `queryFn` and `enabled` are managed by
@@ -53,6 +54,24 @@ export interface PieRootProps {
53
54
  config: PieConfig;
54
55
  /** Optional react-query overrides; see {@link PieQueryOptions}. */
55
56
  queryOptions?: PieQueryOptions;
57
+ /**
58
+ * Config request the host already started before the bundle finished
59
+ * loading. When its `url` matches the one this root would request, the
60
+ * root awaits that promise instead of issuing a second request.
61
+ *
62
+ * Without it the config request is serialized behind the whole client
63
+ * bundle: the root only asks for it from a hook, i.e. after hydration.
64
+ * A host can fire the same request from an inline `<head>` script — build
65
+ * the URL with `buildContentUrl` so both sides agree byte for byte — and
66
+ * hand the promise over here.
67
+ *
68
+ * Single use: a failed or already-consumed prefetch simply falls through
69
+ * to a normal request, so refetches never get a stale answer.
70
+ *
71
+ * @see {@link PieConfigPrefetch}
72
+ * @see buildContentUrl
73
+ */
74
+ configPrefetch?: PieConfigPrefetch;
56
75
  /**
57
76
  * Optional host-supplied react-query `QueryClient`. Pass a stable
58
77
  * (module-singleton) client so the fetched UI-config cache survives a
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/PieRoot/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACjC,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AACxD,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAElC;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG,IAAI,CAC9B,eAAe,CAAC,YAAY,EAAE,UAAU,CAAC,EACzC,UAAU,GAAG,SAAS,GAAG,SAAS,CACrC,CAAA;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IACzB;;;;;OAKG;IACH,QAAQ,EAAE;QACN,QAAQ,EAAE,MAAM,CAAA;QAChB,MAAM,EAAE,MAAM,CAAA;KACjB,CAAA;IACD;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAA;IACvC;;;;;;;;OAQG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,OAAO,KAAK,IAAI,CAAA;IACnC;;;;OAIG;IACH,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;IAClC,oEAAoE;IACpE,MAAM,EAAE,SAAS,CAAA;IACjB,mEAAmE;IACnE,YAAY,CAAC,EAAE,eAAe,CAAA;IAC9B;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAA;CAC9B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/PieRoot/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACjC,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AACxD,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAClC,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAA;AAEhE;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG,IAAI,CAC9B,eAAe,CAAC,YAAY,EAAE,UAAU,CAAC,EACzC,UAAU,GAAG,SAAS,GAAG,SAAS,CACrC,CAAA;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IACzB;;;;;OAKG;IACH,QAAQ,EAAE;QACN,QAAQ,EAAE,MAAM,CAAA;QAChB,MAAM,EAAE,MAAM,CAAA;KACjB,CAAA;IACD;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAA;IACvC;;;;;;;;OAQG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,OAAO,KAAK,IAAI,CAAA;IACnC;;;;OAIG;IACH,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;IAClC,oEAAoE;IACpE,MAAM,EAAE,SAAS,CAAA;IACjB,mEAAmE;IACnE,YAAY,CAAC,EAAE,eAAe,CAAA;IAC9B;;;;;;;;;;;;;;;;OAgBG;IACH,cAAc,CAAC,EAAE,iBAAiB,CAAA;IAClC;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAA;CAC9B"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/PieTelegramRoot/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAkB,MAAM,OAAO,CAAA;AAOtC,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAsL/C;;;;;;;;;;;;GAYG;AACH,QAAA,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAiB3C,CAAA;eAEc,eAAe"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/PieTelegramRoot/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAkB,MAAM,OAAO,CAAA;AAOtC,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAkM/C;;;;;;;;;;;;GAYG;AACH,QAAA,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAiB3C,CAAA;eAEc,eAAe"}