create-nextly-app 0.0.2-alpha.60 → 0.0.2-alpha.64

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/index.cjs CHANGED
@@ -6810,12 +6810,31 @@ var require_data = __commonJS2({
6810
6810
  }
6811
6811
  });
6812
6812
  var require_utils = __commonJS2({
6813
- "../../node_modules/.pnpm/fast-uri@3.1.5/node_modules/fast-uri/lib/utils.js"(exports$1, module) {
6813
+ "../../node_modules/.pnpm/fast-uri@3.1.7/node_modules/fast-uri/lib/utils.js"(exports$1, module) {
6814
6814
  var isUUID = RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu);
6815
6815
  var isIPv4 = RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);
6816
+ var isPort = RegExp.prototype.test.bind(/^\d*$/u);
6816
6817
  var isHexPair = RegExp.prototype.test.bind(/^[\da-f]{2}$/iu);
6817
6818
  var isUnreserved = RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu);
6818
- var isPathCharacter = RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);
6819
+ var isPathCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u);
6820
+ var isQueryFragmentCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u);
6821
+ var isUserinfoCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u);
6822
+ var BYTE_HEX = new Array(256);
6823
+ {
6824
+ const HEX_DIGITS = "0123456789ABCDEF";
6825
+ for (let i2 = 0; i2 < 256; i2++) {
6826
+ BYTE_HEX[i2] = "%" + HEX_DIGITS[i2 >> 4] + HEX_DIGITS[i2 & 15];
6827
+ }
6828
+ }
6829
+ function percentEncodeNonAscii(cp) {
6830
+ if (cp < 2048) {
6831
+ return BYTE_HEX[192 | cp >> 6] + BYTE_HEX[128 | cp & 63];
6832
+ }
6833
+ if (cp < 65536) {
6834
+ return BYTE_HEX[224 | cp >> 12] + BYTE_HEX[128 | cp >> 6 & 63] + BYTE_HEX[128 | cp & 63];
6835
+ }
6836
+ return BYTE_HEX[240 | cp >> 18] + BYTE_HEX[128 | cp >> 12 & 63] + BYTE_HEX[128 | cp >> 6 & 63] + BYTE_HEX[128 | cp & 63];
6837
+ }
6819
6838
  function stringArrayToHexStripped(input) {
6820
6839
  let acc = "";
6821
6840
  let code = 0;
@@ -6840,91 +6859,105 @@ var require_utils = __commonJS2({
6840
6859
  }
6841
6860
  return acc;
6842
6861
  }
6862
+ var isHextet = RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/);
6863
+ var isIPvFuture = RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/);
6864
+ var isZoneCharacter = RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/);
6843
6865
  var nonSimpleDomain = RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);
6844
- function consumeIsZone(buffer) {
6845
- buffer.length = 0;
6846
- return true;
6847
- }
6848
- function consumeHextets(buffer, address, output) {
6849
- if (buffer.length) {
6850
- const hex = stringArrayToHexStripped(buffer);
6851
- if (hex !== "") {
6852
- address.push(hex);
6853
- } else {
6854
- output.error = true;
6855
- return false;
6866
+ function isZoneIdentifier(zone) {
6867
+ if (zone.length === 0) return false;
6868
+ for (let i2 = 0; i2 < zone.length; i2++) {
6869
+ if (isZoneCharacter(zone[i2])) continue;
6870
+ if (zone[i2] === "%" && i2 + 2 < zone.length && isHexPair(zone.slice(i2 + 1, i2 + 3))) {
6871
+ i2 += 2;
6872
+ continue;
6856
6873
  }
6857
- buffer.length = 0;
6874
+ return false;
6858
6875
  }
6859
6876
  return true;
6860
6877
  }
6861
- function getIPV6(input) {
6862
- let tokenCount = 0;
6863
- const output = { error: false, address: "", zone: "" };
6864
- const address = [];
6865
- const buffer = [];
6866
- let endipv6Encountered = false;
6867
- let endIpv6 = false;
6868
- let consume = consumeHextets;
6869
- for (let i2 = 0; i2 < input.length; i2++) {
6870
- const cursor = input[i2];
6871
- if (cursor === "[" || cursor === "]") {
6872
- continue;
6873
- }
6874
- if (cursor === ":") {
6875
- if (endipv6Encountered === true) {
6876
- endIpv6 = true;
6877
- }
6878
- if (!consume(buffer, address, output)) {
6879
- break;
6880
- }
6881
- if (++tokenCount > 7) {
6882
- output.error = true;
6883
- break;
6878
+ function compressIPv6ZeroRun(hextets) {
6879
+ let bestStart = -1;
6880
+ let bestLength = 0;
6881
+ let runStart = -1;
6882
+ let runLength = 0;
6883
+ for (let i2 = 0; i2 < hextets.length; i2++) {
6884
+ if (hextets[i2] === "0") {
6885
+ if (runStart === -1) runStart = i2;
6886
+ runLength++;
6887
+ if (runLength > bestLength) {
6888
+ bestLength = runLength;
6889
+ bestStart = runStart;
6884
6890
  }
6885
- if (i2 > 0 && input[i2 - 1] === ":") {
6886
- endipv6Encountered = true;
6887
- }
6888
- address.push(":");
6889
- continue;
6890
- } else if (cursor === "%") {
6891
- if (!consume(buffer, address, output)) {
6892
- break;
6893
- }
6894
- consume = consumeIsZone;
6895
6891
  } else {
6896
- buffer.push(cursor);
6892
+ runStart = -1;
6893
+ runLength = 0;
6894
+ }
6895
+ }
6896
+ if (bestLength < 2) return hextets.join(":");
6897
+ const head = hextets.slice(0, bestStart).join(":");
6898
+ const tail = hextets.slice(bestStart + bestLength).join(":");
6899
+ return head + "::" + tail;
6900
+ }
6901
+ function normalizeIPv6Address(input) {
6902
+ const compression = input.indexOf("::");
6903
+ if (compression !== -1 && input.indexOf("::", compression + 1) !== -1) return void 0;
6904
+ const left = compression === -1 ? input.split(":") : input.slice(0, compression).split(":");
6905
+ const right = compression === -1 ? [] : input.slice(compression + 2).split(":");
6906
+ if (compression !== -1) {
6907
+ if (left.length === 1 && left[0] === "") left.length = 0;
6908
+ if (right.length === 1 && right[0] === "") right.length = 0;
6909
+ }
6910
+ const parts = left.concat(right);
6911
+ let hextetCount = 0;
6912
+ for (let i2 = 0; i2 < parts.length; i2++) {
6913
+ const part = parts[i2];
6914
+ if (part === "") return void 0;
6915
+ if (part.indexOf(".") !== -1) {
6916
+ if (i2 !== parts.length - 1 || compression !== -1 && right.length === 0 || !isIPv4(part)) return void 0;
6917
+ hextetCount += 2;
6897
6918
  continue;
6898
6919
  }
6920
+ if (!isHextet(part)) return void 0;
6921
+ parts[i2] = parseInt(part, 16).toString(16);
6922
+ hextetCount++;
6899
6923
  }
6900
- if (buffer.length) {
6901
- if (consume === consumeIsZone) {
6902
- output.zone = buffer.join("");
6903
- } else if (endIpv6) {
6904
- address.push(buffer.join(""));
6905
- } else {
6906
- address.push(stringArrayToHexStripped(buffer));
6907
- }
6924
+ if (compression === -1) {
6925
+ if (hextetCount !== 8) return void 0;
6926
+ return compressIPv6ZeroRun(parts);
6908
6927
  }
6909
- output.address = address.join("");
6910
- return output;
6928
+ if (hextetCount >= 8) return void 0;
6929
+ const expanded = parts.slice(0, left.length);
6930
+ for (let i2 = hextetCount; i2 < 8; i2++) expanded.push("0");
6931
+ for (let i2 = left.length; i2 < parts.length; i2++) expanded.push(parts[i2]);
6932
+ return compressIPv6ZeroRun(expanded);
6911
6933
  }
6912
6934
  function normalizeIPv6(host) {
6913
- if (findToken(host, ":") < 2) {
6914
- return { host, isIPV6: false };
6915
- }
6916
- const ipv6 = getIPV6(host);
6917
- if (!ipv6.error) {
6918
- let newHost = ipv6.address;
6919
- let escapedHost = ipv6.address;
6920
- if (ipv6.zone) {
6921
- newHost += "%" + ipv6.zone;
6922
- escapedHost += "%25" + ipv6.zone;
6923
- }
6924
- return { host: newHost, isIPV6: true, escapedHost };
6925
- } else {
6926
- return { host, isIPV6: false };
6927
- }
6935
+ const bracketed = host[0] === "[" && host[host.length - 1] === "]";
6936
+ const hasBracket = host[0] === "[" || host[host.length - 1] === "]";
6937
+ if (hasBracket && !bracketed) return { host, isIPV6: false, error: true };
6938
+ let input = bracketed ? host.slice(1, -1) : host;
6939
+ if (bracketed && isIPvFuture(input)) {
6940
+ input = input.toLowerCase();
6941
+ return { host: `[${input}]`, escapedHost: input, isIPV6: false, isIPVFuture: true };
6942
+ }
6943
+ if (findToken(input, ":") < 2) {
6944
+ return { host, isIPV6: false, error: bracketed };
6945
+ }
6946
+ let zoneIdentifier = "";
6947
+ const zoneSeparator = input.indexOf("%");
6948
+ if (zoneSeparator !== -1) {
6949
+ const separatorLength = input.slice(zoneSeparator, zoneSeparator + 3).toLowerCase() === "%25" ? 3 : 1;
6950
+ zoneIdentifier = input.slice(zoneSeparator + separatorLength);
6951
+ if (!isZoneIdentifier(zoneIdentifier)) return { host, isIPV6: false, error: true };
6952
+ input = input.slice(0, zoneSeparator);
6953
+ }
6954
+ const address = normalizeIPv6Address(input);
6955
+ if (address === void 0) return { host, isIPV6: false, error: true };
6956
+ return {
6957
+ host: address + (zoneIdentifier ? "%" + zoneIdentifier : ""),
6958
+ escapedHost: address + (zoneIdentifier ? "%25" + zoneIdentifier : ""),
6959
+ isIPV6: true
6960
+ };
6928
6961
  }
6929
6962
  function findToken(str, token) {
6930
6963
  let ind = 0;
@@ -7043,7 +7076,8 @@ var require_utils = __commonJS2({
7043
7076
  function normalizePathEncoding(input) {
7044
7077
  let output = "";
7045
7078
  for (let i2 = 0; i2 < input.length; i2++) {
7046
- if (input[i2] === "%" && i2 + 2 < input.length) {
7079
+ const ch = input[i2];
7080
+ if (ch === "%" && i2 + 2 < input.length) {
7047
7081
  const hex = input.slice(i2 + 1, i2 + 3);
7048
7082
  if (isHexPair(hex)) {
7049
7083
  const normalizedHex = hex.toUpperCase();
@@ -7057,10 +7091,152 @@ var require_utils = __commonJS2({
7057
7091
  continue;
7058
7092
  }
7059
7093
  }
7060
- if (isPathCharacter(input[i2])) {
7061
- output += input[i2];
7094
+ if (isPathCharacter(ch)) {
7095
+ output += ch;
7096
+ } else {
7097
+ const code = input.charCodeAt(i2);
7098
+ if (code < 128) {
7099
+ output += isEscapeSafe(code) ? ch : BYTE_HEX[code];
7100
+ } else if (code < 55296 || code > 57343) {
7101
+ output += percentEncodeNonAscii(code);
7102
+ } else if (code <= 56319 && i2 + 1 < input.length) {
7103
+ const low = input.charCodeAt(i2 + 1);
7104
+ if (low >= 56320 && low <= 57343) {
7105
+ output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
7106
+ i2++;
7107
+ } else {
7108
+ output += percentEncodeNonAscii(65533);
7109
+ }
7110
+ } else {
7111
+ output += percentEncodeNonAscii(65533);
7112
+ }
7113
+ }
7114
+ }
7115
+ return output;
7116
+ }
7117
+ function serializePathEncoding(input, pathNoScheme = false) {
7118
+ let output = "";
7119
+ let firstSegment = pathNoScheme && input[0] !== "/";
7120
+ for (let i2 = 0; i2 < input.length; i2++) {
7121
+ const ch = input[i2];
7122
+ if (ch === "%" && i2 + 2 < input.length) {
7123
+ const hex = input.slice(i2 + 1, i2 + 3);
7124
+ if (isHexPair(hex)) {
7125
+ output += "%" + hex.toUpperCase();
7126
+ i2 += 2;
7127
+ continue;
7128
+ }
7129
+ }
7130
+ if (ch === "/") {
7131
+ firstSegment = false;
7132
+ }
7133
+ if (isPathCharacter(ch) && (ch !== ":" || !firstSegment)) {
7134
+ output += ch;
7062
7135
  } else {
7063
- output += escape(input[i2]);
7136
+ const code = input.charCodeAt(i2);
7137
+ if (code < 128) {
7138
+ output += BYTE_HEX[code];
7139
+ } else if (code < 55296 || code > 57343) {
7140
+ output += percentEncodeNonAscii(code);
7141
+ } else if (code <= 56319 && i2 + 1 < input.length) {
7142
+ const low = input.charCodeAt(i2 + 1);
7143
+ if (low >= 56320 && low <= 57343) {
7144
+ output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
7145
+ i2++;
7146
+ } else {
7147
+ output += percentEncodeNonAscii(65533);
7148
+ }
7149
+ } else {
7150
+ output += percentEncodeNonAscii(65533);
7151
+ }
7152
+ }
7153
+ }
7154
+ return output;
7155
+ }
7156
+ function encodeComponent(input, isAllowed) {
7157
+ let output = "";
7158
+ for (let i2 = 0; i2 < input.length; i2++) {
7159
+ const ch = input[i2];
7160
+ if (ch === "%" && i2 + 2 < input.length) {
7161
+ const hex = input.slice(i2 + 1, i2 + 3);
7162
+ if (isHexPair(hex)) {
7163
+ output += "%" + hex.toUpperCase();
7164
+ i2 += 2;
7165
+ continue;
7166
+ }
7167
+ }
7168
+ if (isAllowed(ch)) {
7169
+ output += ch;
7170
+ } else {
7171
+ const code = input.charCodeAt(i2);
7172
+ if (code < 128) {
7173
+ output += BYTE_HEX[code];
7174
+ } else if (code < 55296 || code > 57343) {
7175
+ output += percentEncodeNonAscii(code);
7176
+ } else if (code <= 56319 && i2 + 1 < input.length) {
7177
+ const low = input.charCodeAt(i2 + 1);
7178
+ if (low >= 56320 && low <= 57343) {
7179
+ output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
7180
+ i2++;
7181
+ } else {
7182
+ output += percentEncodeNonAscii(65533);
7183
+ }
7184
+ } else {
7185
+ output += percentEncodeNonAscii(65533);
7186
+ }
7187
+ }
7188
+ }
7189
+ return output;
7190
+ }
7191
+ function encodeUserinfo(input) {
7192
+ return encodeComponent(input, isUserinfoCharacter);
7193
+ }
7194
+ function encodeQuery(input) {
7195
+ return encodeComponent(input, isQueryFragmentCharacter);
7196
+ }
7197
+ function encodeFragment(input) {
7198
+ return encodeComponent(input, isQueryFragmentCharacter);
7199
+ }
7200
+ function isEscapeSafe(cp) {
7201
+ return cp >= 48 && cp <= 57 || cp >= 65 && cp <= 90 || cp >= 97 && cp <= 122 || cp === 42 || cp === 43 || cp === 45 || cp === 46 || cp === 47 || cp === 64 || cp === 95;
7202
+ }
7203
+ function normalizeQueryFragmentEncoding(input) {
7204
+ let output = "";
7205
+ for (let i2 = 0; i2 < input.length; i2++) {
7206
+ const ch = input[i2];
7207
+ if (ch === "%" && i2 + 2 < input.length) {
7208
+ const hex = input.slice(i2 + 1, i2 + 3);
7209
+ if (isHexPair(hex)) {
7210
+ const normalizedHex = hex.toUpperCase();
7211
+ const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
7212
+ if (isUnreserved(decoded)) {
7213
+ output += decoded;
7214
+ } else {
7215
+ output += "%" + normalizedHex;
7216
+ }
7217
+ i2 += 2;
7218
+ continue;
7219
+ }
7220
+ }
7221
+ if (isQueryFragmentCharacter(ch)) {
7222
+ output += ch;
7223
+ } else {
7224
+ const code = input.charCodeAt(i2);
7225
+ if (code < 128) {
7226
+ output += isEscapeSafe(code) ? ch : BYTE_HEX[code];
7227
+ } else if (code < 55296 || code > 57343) {
7228
+ output += percentEncodeNonAscii(code);
7229
+ } else if (code <= 56319 && i2 + 1 < input.length) {
7230
+ const low = input.charCodeAt(i2 + 1);
7231
+ if (low >= 56320 && low <= 57343) {
7232
+ output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
7233
+ i2++;
7234
+ } else {
7235
+ output += percentEncodeNonAscii(65533);
7236
+ }
7237
+ } else {
7238
+ output += percentEncodeNonAscii(65533);
7239
+ }
7064
7240
  }
7065
7241
  }
7066
7242
  return output;
@@ -7083,14 +7259,18 @@ var require_utils = __commonJS2({
7083
7259
  function recomposeAuthority(component) {
7084
7260
  const uriTokens = [];
7085
7261
  if (component.userinfo !== void 0) {
7086
- uriTokens.push(component.userinfo);
7262
+ uriTokens.push(encodeUserinfo(component.userinfo));
7087
7263
  uriTokens.push("@");
7088
7264
  }
7089
7265
  if (component.host !== void 0) {
7090
- let host = unescape(component.host);
7266
+ let host = component.host;
7091
7267
  if (!isIPv4(host)) {
7092
- const ipV6res = normalizeIPv6(host);
7093
- if (ipV6res.isIPV6 === true) {
7268
+ let ipV6res = normalizeIPv6(host);
7269
+ if (ipV6res.isIPV6 !== true && ipV6res.isIPVFuture !== true) {
7270
+ host = normalizePercentEncoding(host, true);
7271
+ ipV6res = normalizeIPv6(host);
7272
+ }
7273
+ if (ipV6res.isIPV6 === true || ipV6res.isIPVFuture === true) {
7094
7274
  host = `[${ipV6res.escapedHost}]`;
7095
7275
  } else {
7096
7276
  host = reescapeHostDelimiters(host, false);
@@ -7099,8 +7279,12 @@ var require_utils = __commonJS2({
7099
7279
  uriTokens.push(host);
7100
7280
  }
7101
7281
  if (typeof component.port === "number" || typeof component.port === "string") {
7282
+ const port = String(component.port);
7283
+ if (!isPort(port)) {
7284
+ throw new TypeError("URI port is malformed.");
7285
+ }
7102
7286
  uriTokens.push(":");
7103
- uriTokens.push(String(component.port));
7287
+ uriTokens.push(port);
7104
7288
  }
7105
7289
  return uriTokens.length ? uriTokens.join("") : void 0;
7106
7290
  }
@@ -7110,6 +7294,11 @@ var require_utils = __commonJS2({
7110
7294
  reescapeHostDelimiters,
7111
7295
  normalizePercentEncoding,
7112
7296
  normalizePathEncoding,
7297
+ serializePathEncoding,
7298
+ normalizeQueryFragmentEncoding,
7299
+ encodeUserinfo,
7300
+ encodeQuery,
7301
+ encodeFragment,
7113
7302
  escapePreservingEscapes,
7114
7303
  removeDotSegments,
7115
7304
  isIPv4,
@@ -7120,9 +7309,9 @@ var require_utils = __commonJS2({
7120
7309
  }
7121
7310
  });
7122
7311
  var require_schemes = __commonJS2({
7123
- "../../node_modules/.pnpm/fast-uri@3.1.5/node_modules/fast-uri/lib/schemes.js"(exports$1, module) {
7312
+ "../../node_modules/.pnpm/fast-uri@3.1.7/node_modules/fast-uri/lib/schemes.js"(exports$1, module) {
7124
7313
  var { isUUID } = require_utils();
7125
- var URN_REG = /([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;
7314
+ var URN_REG = /^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu;
7126
7315
  var supportedSchemeNames = (
7127
7316
  /** @type {const} */
7128
7317
  [
@@ -7183,9 +7372,10 @@ var require_schemes = __commonJS2({
7183
7372
  wsComponent.secure = void 0;
7184
7373
  }
7185
7374
  if (wsComponent.resourceName) {
7186
- const [path52, query] = wsComponent.resourceName.split("?");
7375
+ const queryIndex = wsComponent.resourceName.indexOf("?");
7376
+ const path52 = queryIndex === -1 ? wsComponent.resourceName : wsComponent.resourceName.slice(0, queryIndex);
7187
7377
  wsComponent.path = path52 && path52 !== "/" ? path52 : void 0;
7188
- wsComponent.query = query;
7378
+ wsComponent.query = queryIndex === -1 ? void 0 : wsComponent.resourceName.slice(queryIndex + 1);
7189
7379
  wsComponent.resourceName = void 0;
7190
7380
  }
7191
7381
  wsComponent.fragment = void 0;
@@ -7197,7 +7387,7 @@ var require_schemes = __commonJS2({
7197
7387
  return urnComponent;
7198
7388
  }
7199
7389
  const matches = urnComponent.path.match(URN_REG);
7200
- if (matches) {
7390
+ if (matches && matches[0] === urnComponent.path) {
7201
7391
  const scheme = options.scheme || urnComponent.scheme || "urn";
7202
7392
  urnComponent.nid = matches[1].toLowerCase();
7203
7393
  urnComponent.nss = matches[2];
@@ -7327,9 +7517,18 @@ var require_schemes = __commonJS2({
7327
7517
  }
7328
7518
  });
7329
7519
  var require_fast_uri = __commonJS2({
7330
- "../../node_modules/.pnpm/fast-uri@3.1.5/node_modules/fast-uri/index.js"(exports$1, module) {
7331
- var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, escapePreservingEscapes, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils();
7520
+ "../../node_modules/.pnpm/fast-uri@3.1.7/node_modules/fast-uri/index.js"(exports$1, module) {
7521
+ var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, serializePathEncoding, normalizeQueryFragmentEncoding, encodeQuery, encodeFragment, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils();
7332
7522
  var { SCHEMES, getSchemeHandler } = require_schemes();
7523
+ var VALID_SCHEME = /^[A-Za-z][A-Za-z0-9+.-]*$/u;
7524
+ var MALFORMED_SCHEME_ERROR = "URI scheme is malformed.";
7525
+ function decodeValidScheme(scheme) {
7526
+ const decodedScheme = unescape(String(scheme));
7527
+ if (!VALID_SCHEME.test(decodedScheme)) {
7528
+ throw new TypeError(MALFORMED_SCHEME_ERROR);
7529
+ }
7530
+ return decodedScheme;
7531
+ }
7333
7532
  function normalize(uri, options) {
7334
7533
  if (typeof uri === "string") {
7335
7534
  uri = /** @type {T} */
@@ -7342,12 +7541,34 @@ var require_fast_uri = __commonJS2({
7342
7541
  }
7343
7542
  function resolve(baseURI, relativeURI, options) {
7344
7543
  const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
7345
- const { parsed: baseParsed, malformedAuthorityOrPort: baseMalformed } = parseWithStatus(baseURI, schemelessOptions);
7346
- const { parsed: relativeParsed, malformedAuthorityOrPort: relativeMalformed } = parseWithStatus(relativeURI, schemelessOptions);
7347
- if (baseMalformed || relativeMalformed) {
7544
+ const {
7545
+ parsed: baseParsed,
7546
+ malformedAuthorityOrPort: baseMalformed,
7547
+ malformedPercentEncoding: baseMalformedPercentEncoding,
7548
+ malformedSchemeSpecific: baseMalformedSchemeSpecific,
7549
+ malformedHost: baseMalformedHost,
7550
+ malformedScheme: baseMalformedScheme
7551
+ } = parseWithStatus(baseURI, schemelessOptions);
7552
+ const {
7553
+ parsed: relativeParsed,
7554
+ malformedAuthorityOrPort: relativeMalformed,
7555
+ malformedPercentEncoding: relativeMalformedPercentEncoding,
7556
+ malformedSchemeSpecific: relativeMalformedSchemeSpecific,
7557
+ malformedHost: relativeMalformedHost,
7558
+ malformedScheme: relativeMalformedScheme
7559
+ } = parseWithStatus(relativeURI, schemelessOptions);
7560
+ if (baseMalformed || relativeMalformed || baseMalformedPercentEncoding || relativeMalformedPercentEncoding || baseMalformedSchemeSpecific || relativeMalformedSchemeSpecific || baseMalformedHost || relativeMalformedHost || baseMalformedScheme || relativeMalformedScheme) {
7348
7561
  throw new Error(baseParsed.error || relativeParsed.error || "URI is malformed.");
7349
7562
  }
7350
7563
  const resolved = resolveComponent(baseParsed, relativeParsed, schemelessOptions, true);
7564
+ const resolvedSchemeHandler = getSchemeHandler(options && options.scheme || resolved.scheme);
7565
+ const resolvedHost = resolved.host;
7566
+ const resolvedHostIsIP = resolvedHost !== void 0 && resolvedHost !== "" && (isIPv4(resolvedHost) || normalizeIPv6(resolvedHost).isIPV6);
7567
+ canonicalizeHost(resolved, options || {}, resolvedSchemeHandler, resolvedHostIsIP);
7568
+ const encodedASCIIHost = resolvedHost && resolvedHost.indexOf("%") !== -1 && !new RegExp("\\P{ASCII}", "u").test(resolvedHost);
7569
+ if (resolved.error && !encodedASCIIHost) {
7570
+ throw new Error(resolved.error);
7571
+ }
7351
7572
  schemelessOptions.skipEscape = true;
7352
7573
  return serialize2(resolved, schemelessOptions);
7353
7574
  }
@@ -7407,7 +7628,7 @@ var require_fast_uri = __commonJS2({
7407
7628
  function equal(uriA, uriB, options) {
7408
7629
  const normalizedA = normalizeComparableURI(uriA, options);
7409
7630
  const normalizedB = normalizeComparableURI(uriB, options);
7410
- return normalizedA !== void 0 && normalizedB !== void 0 && normalizedA.toLowerCase() === normalizedB.toLowerCase();
7631
+ return normalizedA !== void 0 && normalizedB !== void 0 && normalizedA === normalizedB;
7411
7632
  }
7412
7633
  function serialize2(cmpts, opts) {
7413
7634
  const component = {
@@ -7428,19 +7649,22 @@ var require_fast_uri = __commonJS2({
7428
7649
  };
7429
7650
  const options = Object.assign({}, opts);
7430
7651
  const uriTokens = [];
7652
+ if (component.scheme) {
7653
+ component.scheme = decodeValidScheme(component.scheme);
7654
+ }
7431
7655
  const schemeHandler = getSchemeHandler(options.scheme || component.scheme);
7432
7656
  if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(component, options);
7657
+ const hasAuthority = component.userinfo !== void 0 || component.host !== void 0 || component.port !== void 0;
7658
+ const pathNoScheme = !options.skipEscape && component.scheme === void 0 && !hasAuthority;
7433
7659
  if (component.path !== void 0) {
7434
7660
  if (!options.skipEscape) {
7435
- component.path = escapePreservingEscapes(component.path);
7436
- if (component.scheme !== void 0) {
7437
- component.path = component.path.split("%3A").join(":");
7438
- }
7661
+ component.path = serializePathEncoding(component.path, pathNoScheme);
7439
7662
  } else {
7440
7663
  component.path = normalizePercentEncoding(component.path);
7441
7664
  }
7442
7665
  }
7443
7666
  if (options.reference !== "suffix" && component.scheme) {
7667
+ component.scheme = decodeValidScheme(component.scheme);
7444
7668
  uriTokens.push(component.scheme, ":");
7445
7669
  }
7446
7670
  const authority = recomposeAuthority(component);
@@ -7458,16 +7682,19 @@ var require_fast_uri = __commonJS2({
7458
7682
  if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {
7459
7683
  s3 = removeDotSegments(s3);
7460
7684
  }
7685
+ if (pathNoScheme) {
7686
+ s3 = serializePathEncoding(s3, true);
7687
+ }
7461
7688
  if (authority === void 0 && s3[0] === "/" && s3[1] === "/") {
7462
7689
  s3 = "/%2F" + s3.slice(2);
7463
7690
  }
7464
7691
  uriTokens.push(s3);
7465
7692
  }
7466
7693
  if (component.query !== void 0) {
7467
- uriTokens.push("?", component.query);
7694
+ uriTokens.push("?", encodeQuery(component.query));
7468
7695
  }
7469
7696
  if (component.fragment !== void 0) {
7470
- uriTokens.push("#", component.fragment);
7697
+ uriTokens.push("#", encodeFragment(component.fragment));
7471
7698
  }
7472
7699
  return uriTokens.join("");
7473
7700
  }
@@ -7483,6 +7710,35 @@ var require_fast_uri = __commonJS2({
7483
7710
  }
7484
7711
  return void 0;
7485
7712
  }
7713
+ function hasMalformedPercentEncoding(component) {
7714
+ if (component === void 0) return false;
7715
+ let percent = component.indexOf("%");
7716
+ while (percent !== -1) {
7717
+ if (percent + 2 >= component.length || !/^[\da-f]{2}$/iu.test(component.slice(percent + 1, percent + 3))) {
7718
+ return true;
7719
+ }
7720
+ percent = component.indexOf("%", percent + 3);
7721
+ }
7722
+ return false;
7723
+ }
7724
+ function isIPLiteral(host) {
7725
+ return host[0] === "[" && host[host.length - 1] === "]";
7726
+ }
7727
+ function hasMalformedComponentPercentEncoding(matches) {
7728
+ const host = matches[4];
7729
+ return hasMalformedPercentEncoding(matches[3]) || host !== void 0 && !isIPLiteral(host) && hasMalformedPercentEncoding(host) || hasMalformedPercentEncoding(matches[6]) || hasMalformedPercentEncoding(matches[7]) || hasMalformedPercentEncoding(matches[8]);
7730
+ }
7731
+ function canonicalizeHost(parsed, options, schemeHandler, isIP) {
7732
+ if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport) && parsed.host && !isIPLiteral(parsed.host) && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && nonSimpleDomain(parsed.host)) {
7733
+ try {
7734
+ parsed.host = new URL("http://" + parsed.host).hostname;
7735
+ } catch (e) {
7736
+ parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e;
7737
+ return true;
7738
+ }
7739
+ }
7740
+ return false;
7741
+ }
7486
7742
  function parseWithStatus(uri, opts) {
7487
7743
  const options = Object.assign({}, opts);
7488
7744
  const parsed = {
@@ -7495,6 +7751,11 @@ var require_fast_uri = __commonJS2({
7495
7751
  fragment: void 0
7496
7752
  };
7497
7753
  let malformedAuthorityOrPort = false;
7754
+ let malformedPercentEncoding = false;
7755
+ let malformedSchemeSpecific = false;
7756
+ let malformedHost = false;
7757
+ let malformedIPLiteral = false;
7758
+ let malformedScheme = false;
7498
7759
  let isIP = false;
7499
7760
  if (options.reference === "suffix") {
7500
7761
  if (options.scheme) {
@@ -7531,6 +7792,19 @@ var require_fast_uri = __commonJS2({
7531
7792
  parsed.path = matches[6] || "";
7532
7793
  parsed.query = matches[7];
7533
7794
  parsed.fragment = matches[8];
7795
+ if (parsed.scheme !== void 0) {
7796
+ const decodedScheme = unescape(parsed.scheme);
7797
+ if (VALID_SCHEME.test(decodedScheme)) {
7798
+ parsed.scheme = decodedScheme.toLowerCase();
7799
+ } else {
7800
+ parsed.error = parsed.error || MALFORMED_SCHEME_ERROR;
7801
+ malformedScheme = true;
7802
+ }
7803
+ }
7804
+ malformedPercentEncoding = hasMalformedComponentPercentEncoding(matches);
7805
+ if (malformedPercentEncoding) {
7806
+ parsed.error = parsed.error || "URI contains malformed percent-encoding.";
7807
+ }
7534
7808
  if (isNaN(parsed.port)) {
7535
7809
  parsed.port = matches[5];
7536
7810
  }
@@ -7542,9 +7816,16 @@ var require_fast_uri = __commonJS2({
7542
7816
  if (parsed.host) {
7543
7817
  const ipv4result = isIPv4(parsed.host);
7544
7818
  if (ipv4result === false) {
7819
+ const bracketedIPLiteral = isIPLiteral(parsed.host);
7820
+ const hasIPLiteralBracket = parsed.host.indexOf("[") !== -1 || parsed.host.indexOf("]") !== -1;
7545
7821
  const ipv6result = normalizeIPv6(parsed.host);
7546
- parsed.host = ipv6result.host.toLowerCase();
7547
- isIP = ipv6result.isIPV6;
7822
+ isIP = ipv6result.isIPV6 || ipv6result.isIPVFuture === true;
7823
+ malformedIPLiteral = hasIPLiteralBracket && (!bracketedIPLiteral || ipv6result.error === true);
7824
+ parsed.host = isIP ? ipv6result.host : ipv6result.host.toLowerCase();
7825
+ if (malformedIPLiteral) {
7826
+ parsed.error = parsed.error || "URI host is malformed.";
7827
+ malformedAuthorityOrPort = true;
7828
+ }
7548
7829
  } else {
7549
7830
  isIP = true;
7550
7831
  }
@@ -7562,42 +7843,36 @@ var require_fast_uri = __commonJS2({
7562
7843
  parsed.error = parsed.error || "URI is not a " + options.reference + " reference.";
7563
7844
  }
7564
7845
  const schemeHandler = getSchemeHandler(options.scheme || parsed.scheme);
7565
- if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {
7566
- if (parsed.host && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && nonSimpleDomain(parsed.host)) {
7567
- try {
7568
- parsed.host = new URL("http://" + parsed.host).hostname;
7569
- } catch (e) {
7570
- parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e;
7571
- }
7572
- }
7846
+ if (!malformedIPLiteral) {
7847
+ malformedHost = canonicalizeHost(parsed, options, schemeHandler, isIP);
7573
7848
  }
7574
7849
  if (!schemeHandler || schemeHandler && !schemeHandler.skipNormalize) {
7575
7850
  if (uri.indexOf("%") !== -1) {
7576
- if (parsed.scheme !== void 0) {
7577
- parsed.scheme = unescape(parsed.scheme);
7578
- }
7579
- if (parsed.host !== void 0) {
7580
- parsed.host = reescapeHostDelimiters(unescape(parsed.host), isIP);
7851
+ if (parsed.host !== void 0 && !malformedIPLiteral) {
7852
+ const host = isIP ? parsed.host : normalizePercentEncoding(parsed.host, true);
7853
+ parsed.host = reescapeHostDelimiters(host, isIP);
7581
7854
  }
7582
7855
  }
7583
7856
  if (parsed.path) {
7584
7857
  parsed.path = normalizePathEncoding(parsed.path);
7585
7858
  }
7859
+ if (parsed.query) {
7860
+ parsed.query = normalizeQueryFragmentEncoding(parsed.query);
7861
+ }
7586
7862
  if (parsed.fragment) {
7587
- try {
7588
- parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment));
7589
- } catch {
7590
- parsed.error = parsed.error || "URI malformed";
7591
- }
7863
+ parsed.fragment = normalizeQueryFragmentEncoding(parsed.fragment);
7592
7864
  }
7593
7865
  }
7594
7866
  if (schemeHandler && schemeHandler.parse) {
7595
7867
  schemeHandler.parse(parsed, options);
7868
+ if (schemeHandler === SCHEMES.urn && parsed.nid === void 0) {
7869
+ malformedSchemeSpecific = true;
7870
+ }
7596
7871
  }
7597
7872
  } else {
7598
7873
  parsed.error = parsed.error || "URI can not be parsed.";
7599
7874
  }
7600
- return { parsed, malformedAuthorityOrPort };
7875
+ return { parsed, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme };
7601
7876
  }
7602
7877
  function parse(uri, opts) {
7603
7878
  return parseWithStatus(uri, opts).parsed;
@@ -7606,20 +7881,28 @@ var require_fast_uri = __commonJS2({
7606
7881
  return normalizeStringWithStatus(uri, opts).normalized;
7607
7882
  }
7608
7883
  function normalizeStringWithStatus(uri, opts) {
7609
- const { parsed, malformedAuthorityOrPort } = parseWithStatus(uri, opts);
7884
+ const { parsed, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme } = parseWithStatus(uri, opts);
7610
7885
  return {
7611
- normalized: malformedAuthorityOrPort ? uri : serialize2(parsed, opts),
7612
- malformedAuthorityOrPort
7886
+ normalized: malformedAuthorityOrPort || malformedPercentEncoding || malformedSchemeSpecific || malformedHost || malformedScheme ? uri : serialize2(parsed, opts),
7887
+ malformedAuthorityOrPort,
7888
+ malformedPercentEncoding,
7889
+ malformedSchemeSpecific,
7890
+ malformedHost,
7891
+ malformedScheme
7613
7892
  };
7614
7893
  }
7615
7894
  function normalizeComparableURI(uri, opts) {
7616
- if (typeof uri === "string") {
7617
- const { normalized, malformedAuthorityOrPort } = normalizeStringWithStatus(uri, opts);
7618
- return malformedAuthorityOrPort ? void 0 : normalized;
7895
+ if (typeof uri !== "string" && typeof uri !== "object") {
7896
+ return void 0;
7619
7897
  }
7620
- if (typeof uri === "object") {
7621
- return serialize2(uri, opts);
7898
+ let value;
7899
+ try {
7900
+ value = typeof uri === "string" ? uri : serialize2(uri, opts);
7901
+ } catch {
7902
+ return void 0;
7622
7903
  }
7904
+ const { normalized, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme } = normalizeStringWithStatus(value, opts);
7905
+ return malformedAuthorityOrPort || malformedPercentEncoding || malformedSchemeSpecific || malformedHost || malformedScheme ? void 0 : normalized;
7623
7906
  }
7624
7907
  var fastUri = {
7625
7908
  SCHEMES,
@@ -14384,9 +14667,15 @@ DATABASE_URL=${database.envExample}
14384
14667
  # Authentication (auto-generated, change if needed)
14385
14668
  NEXTLY_SECRET=${generateNextlySecret()}
14386
14669
 
14387
- # Application URL
14670
+ # Where the Nextly app itself lives: the admin, the API, and the origin its
14671
+ # emails and preview links point at.
14388
14672
  NEXT_PUBLIC_APP_URL=http://localhost:3000
14389
14673
 
14674
+ # Where READERS find the public site. Used for canonical links, Open Graph
14675
+ # tags, the sitemap and RSS. Set it when the public site is served from a
14676
+ # different origin than the app above; otherwise the app's origin is used.
14677
+ # NEXT_PUBLIC_SITE_URL=https://example.com
14678
+
14390
14679
  ${DIAGNOSTICS_BLOCK}`;
14391
14680
  }
14392
14681
  async function generateEnv(cwd, database) {
@@ -21216,7 +21505,15 @@ async function walkSourceFiles(root) {
21216
21505
  function projectUsesFormBuilder(projectType) {
21217
21506
  return PROJECT_TYPES_WITH_FORM_BUILDER.has(projectType);
21218
21507
  }
21219
- var CONTENT_TEMPLATE_TYPES = /* @__PURE__ */ new Set(["blog"]);
21508
+ var CONTENT_TEMPLATE_TYPES = /* @__PURE__ */ new Set([
21509
+ "blog",
21510
+ // The plugin template installs `@nextlyhq/eslint-plugin` for the design-token
21511
+ // rules, and that package exists on `alpha` only — `latest` is the conservative
21512
+ // tag and lags the active release line. Pinned to `latest` a plugin scaffold
21513
+ // would resolve a version of it that predates the rules, exactly as a content
21514
+ // scaffold would resolve a `nextly` missing the helpers its pages import.
21515
+ "plugin"
21516
+ ]);
21220
21517
  function templateNextlyChannel(projectType) {
21221
21518
  return CONTENT_TEMPLATE_TYPES.has(projectType) ? "alpha" : "latest";
21222
21519
  }
@@ -21504,7 +21801,12 @@ var PINNED_VERSIONS = {
21504
21801
  "@types/react-dom": "^19",
21505
21802
  "@tailwindcss/postcss": "^4",
21506
21803
  tailwindcss: "^4",
21507
- eslint: "^9"
21804
+ eslint: "^9",
21805
+ // Compiles `nextly.config.ts` so the dev server and the CLI can read it.
21806
+ // An optional peer of `nextly` rather than a dependency, because nothing
21807
+ // that serves a request needs it: a production install omitting dev
21808
+ // dependencies never downloads it.
21809
+ esbuild: "^0.28.1"
21508
21810
  };
21509
21811
  var RUNTIME_RESOLVED_PACKAGES = ["next", "eslint-config-next"];
21510
21812
  var NEXTLY_PACKAGES = [
@@ -21516,7 +21818,8 @@ var NEXTLY_PACKAGES = [
21516
21818
  "@nextlyhq/adapter-mysql",
21517
21819
  "@nextlyhq/adapter-sqlite",
21518
21820
  "@nextlyhq/plugin-form-builder",
21519
- "@nextlyhq/plugin-sdk"
21821
+ "@nextlyhq/plugin-sdk",
21822
+ "@nextlyhq/eslint-plugin"
21520
21823
  ];
21521
21824
  var resolvedNextlyVersions = /* @__PURE__ */ new Map();
21522
21825
  async function fetchLatestVersion(pkg, channel = "latest") {
@@ -21563,7 +21866,11 @@ async function resolveRuntimeVersions() {
21563
21866
  }
21564
21867
  async function generatePackageJson(projectName, database, useYalc = false, projectType = "blank", templateDirs = [], targetDir) {
21565
21868
  if (projectType === "plugin") {
21566
- return generatePluginPackageJson(projectName, useYalc);
21869
+ return generatePluginPackageJson(
21870
+ projectName,
21871
+ useYalc,
21872
+ templateNextlyChannel(projectType)
21873
+ );
21567
21874
  }
21568
21875
  const runtimeVersions = await resolveRuntimeVersions();
21569
21876
  const dependencies = {
@@ -21598,7 +21905,11 @@ async function generatePackageJson(projectName, database, useYalc = false, proje
21598
21905
  "@tailwindcss/postcss": PINNED_VERSIONS["@tailwindcss/postcss"],
21599
21906
  tailwindcss: PINNED_VERSIONS.tailwindcss,
21600
21907
  eslint: PINNED_VERSIONS.eslint,
21601
- "eslint-config-next": runtimeVersions["eslint-config-next"]
21908
+ "eslint-config-next": runtimeVersions["eslint-config-next"],
21909
+ // Declared HERE rather than inherited: `nextly` takes esbuild as an
21910
+ // optional peer, so nothing installs it on a project's behalf. Without it
21911
+ // the dev server cannot read `nextly.config.ts`.
21912
+ esbuild: PINNED_VERSIONS.esbuild
21602
21913
  };
21603
21914
  const shipsSearchIndex = targetDir ? await projectHasSearchIndexScript(targetDir) : false;
21604
21915
  if (shipsSearchIndex) devDependencies.pagefind = "^1.1.0";
@@ -21659,10 +21970,10 @@ async function resolvePluginNextlyRange(useYalc) {
21659
21970
  const v2 = versions["nextly"];
21660
21971
  return v2 && v2 !== "latest" ? v2 : ">=0.0.0";
21661
21972
  }
21662
- async function generatePluginPackageJson(projectName, useYalc) {
21663
- const versions = useYalc ? {} : await resolveNextlyVersions();
21973
+ async function generatePluginPackageJson(projectName, useYalc, channel) {
21974
+ const versions = useYalc ? {} : await resolveNextlyVersions(channel);
21664
21975
  const runtimeVersions = await resolveRuntimeVersions();
21665
- const range = (pkg2) => versions[pkg2] ?? "latest";
21976
+ const range = (pkg2) => versions[pkg2] ?? channel;
21666
21977
  const peerDependencies = {
21667
21978
  nextly: range("nextly"),
21668
21979
  "@nextlyhq/admin": range("@nextlyhq/admin"),
@@ -21694,7 +22005,11 @@ async function generatePluginPackageJson(projectName, useYalc) {
21694
22005
  vitest: "^4.1.0",
21695
22006
  eslint: PINNED_VERSIONS.eslint,
21696
22007
  "@eslint/js": PINNED_VERSIONS.eslint,
21697
- "typescript-eslint": "^8.0.0"
22008
+ "typescript-eslint": "^8.0.0",
22009
+ // The design-token rules the admin holds itself to. Shipped to the author
22010
+ // rather than documented at them: a rule that runs only in Nextly's own
22011
+ // repository governs the first-party plugins and nothing anyone else builds.
22012
+ "@nextlyhq/eslint-plugin": range("@nextlyhq/eslint-plugin")
21698
22013
  };
21699
22014
  const pkg = {
21700
22015
  name: projectName,