@wix/astro 1.0.7 → 1.0.9

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/build/index.js CHANGED
@@ -259,8 +259,8 @@ var require_utils = __commonJS({
259
259
  exports.escapeRegex = (str) => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, "\\$1");
260
260
  exports.toPosixSlashes = (str) => str.replace(REGEX_BACKSLASH, "/");
261
261
  exports.removeBackslashes = (str) => {
262
- return str.replace(REGEX_REMOVE_BACKSLASH, (match) => {
263
- return match === "\\" ? "" : match;
262
+ return str.replace(REGEX_REMOVE_BACKSLASH, (match2) => {
263
+ return match2 === "\\" ? "" : match2;
264
264
  });
265
265
  };
266
266
  exports.supportsLookbehinds = () => {
@@ -883,10 +883,10 @@ var require_parse = __commonJS({
883
883
  push({ type: "text", value });
884
884
  continue;
885
885
  }
886
- const match = /^\\+/.exec(remaining());
886
+ const match2 = /^\\+/.exec(remaining());
887
887
  let slashes = 0;
888
- if (match && match[0].length > 2) {
889
- slashes = match[0].length;
888
+ if (match2 && match2[0].length > 2) {
889
+ slashes = match2[0].length;
890
890
  state.index += slashes;
891
891
  if (slashes % 2 !== 0) {
892
892
  value += "\\";
@@ -1174,10 +1174,10 @@ var require_parse = __commonJS({
1174
1174
  if (value === "$" || value === "^") {
1175
1175
  value = `\\${value}`;
1176
1176
  }
1177
- const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
1178
- if (match) {
1179
- value += match[0];
1180
- state.index += match[0].length;
1177
+ const match2 = REGEX_NON_SPECIAL_CHARS.exec(remaining());
1178
+ if (match2) {
1179
+ value += match2[0];
1180
+ state.index += match2[0].length;
1181
1181
  }
1182
1182
  push({ type: "text", value });
1183
1183
  continue;
@@ -1388,11 +1388,11 @@ var require_parse = __commonJS({
1388
1388
  case "**/.*":
1389
1389
  return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;
1390
1390
  default: {
1391
- const match = /^(.*?)\.(\w+)$/.exec(str);
1392
- if (!match) return;
1393
- const source2 = create(match[1]);
1391
+ const match2 = /^(.*?)\.(\w+)$/.exec(str);
1392
+ if (!match2) return;
1393
+ const source2 = create(match2[1]);
1394
1394
  if (!source2) return;
1395
- return source2 + DOT_LITERAL + match[2];
1395
+ return source2 + DOT_LITERAL + match2[2];
1396
1396
  }
1397
1397
  }
1398
1398
  };
@@ -1445,8 +1445,8 @@ var require_picomatch = __commonJS({
1445
1445
  isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
1446
1446
  }
1447
1447
  const matcher = (input, returnObject = false) => {
1448
- const { isMatch, match, output } = picomatch.test(input, regex, options, { glob, posix });
1449
- const result = { glob, state, regex, posix, input, output, match, isMatch };
1448
+ const { isMatch, match: match2, output } = picomatch.test(input, regex, options, { glob, posix });
1449
+ const result = { glob, state, regex, posix, input, output, match: match2, isMatch };
1450
1450
  if (typeof opts.onResult === "function") {
1451
1451
  opts.onResult(result);
1452
1452
  }
@@ -1480,20 +1480,20 @@ var require_picomatch = __commonJS({
1480
1480
  }
1481
1481
  const opts = options || {};
1482
1482
  const format = opts.format || (posix ? utils.toPosixSlashes : null);
1483
- let match = input === glob;
1484
- let output = match && format ? format(input) : input;
1485
- if (match === false) {
1483
+ let match2 = input === glob;
1484
+ let output = match2 && format ? format(input) : input;
1485
+ if (match2 === false) {
1486
1486
  output = format ? format(input) : input;
1487
- match = output === glob;
1487
+ match2 = output === glob;
1488
1488
  }
1489
- if (match === false || opts.capture === true) {
1489
+ if (match2 === false || opts.capture === true) {
1490
1490
  if (opts.matchBase === true || opts.basename === true) {
1491
- match = picomatch.matchBase(input, regex, options, posix);
1491
+ match2 = picomatch.matchBase(input, regex, options, posix);
1492
1492
  } else {
1493
- match = regex.exec(output);
1493
+ match2 = regex.exec(output);
1494
1494
  }
1495
1495
  }
1496
- return { isMatch: Boolean(match), match, output };
1496
+ return { isMatch: Boolean(match2), match: match2, output };
1497
1497
  };
1498
1498
  picomatch.matchBase = (input, glob, options, posix = utils.isWindows(options)) => {
1499
1499
  const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
@@ -2006,8 +2006,8 @@ var require_utils2 = __commonJS({
2006
2006
  exports.escapeRegex = (str) => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, "\\$1");
2007
2007
  exports.toPosixSlashes = (str) => str.replace(REGEX_BACKSLASH, "/");
2008
2008
  exports.removeBackslashes = (str) => {
2009
- return str.replace(REGEX_REMOVE_BACKSLASH, (match) => {
2010
- return match === "\\" ? "" : match;
2009
+ return str.replace(REGEX_REMOVE_BACKSLASH, (match2) => {
2010
+ return match2 === "\\" ? "" : match2;
2011
2011
  });
2012
2012
  };
2013
2013
  exports.supportsLookbehinds = () => {
@@ -2630,10 +2630,10 @@ var require_parse2 = __commonJS({
2630
2630
  push({ type: "text", value });
2631
2631
  continue;
2632
2632
  }
2633
- const match = /^\\+/.exec(remaining());
2633
+ const match2 = /^\\+/.exec(remaining());
2634
2634
  let slashes = 0;
2635
- if (match && match[0].length > 2) {
2636
- slashes = match[0].length;
2635
+ if (match2 && match2[0].length > 2) {
2636
+ slashes = match2[0].length;
2637
2637
  state.index += slashes;
2638
2638
  if (slashes % 2 !== 0) {
2639
2639
  value += "\\";
@@ -2921,10 +2921,10 @@ var require_parse2 = __commonJS({
2921
2921
  if (value === "$" || value === "^") {
2922
2922
  value = `\\${value}`;
2923
2923
  }
2924
- const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
2925
- if (match) {
2926
- value += match[0];
2927
- state.index += match[0].length;
2924
+ const match2 = REGEX_NON_SPECIAL_CHARS.exec(remaining());
2925
+ if (match2) {
2926
+ value += match2[0];
2927
+ state.index += match2[0].length;
2928
2928
  }
2929
2929
  push({ type: "text", value });
2930
2930
  continue;
@@ -3135,11 +3135,11 @@ var require_parse2 = __commonJS({
3135
3135
  case "**/.*":
3136
3136
  return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;
3137
3137
  default: {
3138
- const match = /^(.*?)\.(\w+)$/.exec(str);
3139
- if (!match) return;
3140
- const source2 = create(match[1]);
3138
+ const match2 = /^(.*?)\.(\w+)$/.exec(str);
3139
+ if (!match2) return;
3140
+ const source2 = create(match2[1]);
3141
3141
  if (!source2) return;
3142
- return source2 + DOT_LITERAL + match[2];
3142
+ return source2 + DOT_LITERAL + match2[2];
3143
3143
  }
3144
3144
  }
3145
3145
  };
@@ -3192,8 +3192,8 @@ var require_picomatch3 = __commonJS({
3192
3192
  isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
3193
3193
  }
3194
3194
  const matcher = (input, returnObject = false) => {
3195
- const { isMatch, match, output } = picomatch.test(input, regex, options, { glob, posix });
3196
- const result = { glob, state, regex, posix, input, output, match, isMatch };
3195
+ const { isMatch, match: match2, output } = picomatch.test(input, regex, options, { glob, posix });
3196
+ const result = { glob, state, regex, posix, input, output, match: match2, isMatch };
3197
3197
  if (typeof opts.onResult === "function") {
3198
3198
  opts.onResult(result);
3199
3199
  }
@@ -3227,20 +3227,20 @@ var require_picomatch3 = __commonJS({
3227
3227
  }
3228
3228
  const opts = options || {};
3229
3229
  const format = opts.format || (posix ? utils.toPosixSlashes : null);
3230
- let match = input === glob;
3231
- let output = match && format ? format(input) : input;
3232
- if (match === false) {
3230
+ let match2 = input === glob;
3231
+ let output = match2 && format ? format(input) : input;
3232
+ if (match2 === false) {
3233
3233
  output = format ? format(input) : input;
3234
- match = output === glob;
3234
+ match2 = output === glob;
3235
3235
  }
3236
- if (match === false || opts.capture === true) {
3236
+ if (match2 === false || opts.capture === true) {
3237
3237
  if (opts.matchBase === true || opts.basename === true) {
3238
- match = picomatch.matchBase(input, regex, options, posix);
3238
+ match2 = picomatch.matchBase(input, regex, options, posix);
3239
3239
  } else {
3240
- match = regex.exec(output);
3240
+ match2 = regex.exec(output);
3241
3241
  }
3242
3242
  }
3243
- return { isMatch: Boolean(match), match, output };
3243
+ return { isMatch: Boolean(match2), match: match2, output };
3244
3244
  };
3245
3245
  picomatch.matchBase = (input, glob, options, posix = utils.isWindows(options)) => {
3246
3246
  const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
@@ -3411,10 +3411,10 @@ var require_is_extglob = __commonJS({
3411
3411
  if (typeof str !== "string" || str === "") {
3412
3412
  return false;
3413
3413
  }
3414
- var match;
3415
- while (match = /(\\).|([@?!+*]\(.*\))/g.exec(str)) {
3416
- if (match[2]) return true;
3417
- str = str.slice(match.index + match[0].length);
3414
+ var match2;
3415
+ while (match2 = /(\\).|([@?!+*]\(.*\))/g.exec(str)) {
3416
+ if (match2[2]) return true;
3417
+ str = str.slice(match2.index + match2[0].length);
3418
3418
  }
3419
3419
  return false;
3420
3420
  };
@@ -7002,8 +7002,8 @@ var require_utils4 = __commonJS({
7002
7002
  exports.escapeRegex = (str) => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, "\\$1");
7003
7003
  exports.toPosixSlashes = (str) => str.replace(REGEX_BACKSLASH, "/");
7004
7004
  exports.removeBackslashes = (str) => {
7005
- return str.replace(REGEX_REMOVE_BACKSLASH, (match) => {
7006
- return match === "\\" ? "" : match;
7005
+ return str.replace(REGEX_REMOVE_BACKSLASH, (match2) => {
7006
+ return match2 === "\\" ? "" : match2;
7007
7007
  });
7008
7008
  };
7009
7009
  exports.supportsLookbehinds = () => {
@@ -7626,10 +7626,10 @@ var require_parse4 = __commonJS({
7626
7626
  push({ type: "text", value });
7627
7627
  continue;
7628
7628
  }
7629
- const match = /^\\+/.exec(remaining());
7629
+ const match2 = /^\\+/.exec(remaining());
7630
7630
  let slashes = 0;
7631
- if (match && match[0].length > 2) {
7632
- slashes = match[0].length;
7631
+ if (match2 && match2[0].length > 2) {
7632
+ slashes = match2[0].length;
7633
7633
  state.index += slashes;
7634
7634
  if (slashes % 2 !== 0) {
7635
7635
  value += "\\";
@@ -7917,10 +7917,10 @@ var require_parse4 = __commonJS({
7917
7917
  if (value === "$" || value === "^") {
7918
7918
  value = `\\${value}`;
7919
7919
  }
7920
- const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
7921
- if (match) {
7922
- value += match[0];
7923
- state.index += match[0].length;
7920
+ const match2 = REGEX_NON_SPECIAL_CHARS.exec(remaining());
7921
+ if (match2) {
7922
+ value += match2[0];
7923
+ state.index += match2[0].length;
7924
7924
  }
7925
7925
  push({ type: "text", value });
7926
7926
  continue;
@@ -8131,11 +8131,11 @@ var require_parse4 = __commonJS({
8131
8131
  case "**/.*":
8132
8132
  return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;
8133
8133
  default: {
8134
- const match = /^(.*?)\.(\w+)$/.exec(str);
8135
- if (!match) return;
8136
- const source2 = create(match[1]);
8134
+ const match2 = /^(.*?)\.(\w+)$/.exec(str);
8135
+ if (!match2) return;
8136
+ const source2 = create(match2[1]);
8137
8137
  if (!source2) return;
8138
- return source2 + DOT_LITERAL + match[2];
8138
+ return source2 + DOT_LITERAL + match2[2];
8139
8139
  }
8140
8140
  }
8141
8141
  };
@@ -8188,8 +8188,8 @@ var require_picomatch5 = __commonJS({
8188
8188
  isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
8189
8189
  }
8190
8190
  const matcher = (input, returnObject = false) => {
8191
- const { isMatch, match, output } = picomatch.test(input, regex, options, { glob, posix });
8192
- const result = { glob, state, regex, posix, input, output, match, isMatch };
8191
+ const { isMatch, match: match2, output } = picomatch.test(input, regex, options, { glob, posix });
8192
+ const result = { glob, state, regex, posix, input, output, match: match2, isMatch };
8193
8193
  if (typeof opts.onResult === "function") {
8194
8194
  opts.onResult(result);
8195
8195
  }
@@ -8223,20 +8223,20 @@ var require_picomatch5 = __commonJS({
8223
8223
  }
8224
8224
  const opts = options || {};
8225
8225
  const format = opts.format || (posix ? utils.toPosixSlashes : null);
8226
- let match = input === glob;
8227
- let output = match && format ? format(input) : input;
8228
- if (match === false) {
8226
+ let match2 = input === glob;
8227
+ let output = match2 && format ? format(input) : input;
8228
+ if (match2 === false) {
8229
8229
  output = format ? format(input) : input;
8230
- match = output === glob;
8230
+ match2 = output === glob;
8231
8231
  }
8232
- if (match === false || opts.capture === true) {
8232
+ if (match2 === false || opts.capture === true) {
8233
8233
  if (opts.matchBase === true || opts.basename === true) {
8234
- match = picomatch.matchBase(input, regex, options, posix);
8234
+ match2 = picomatch.matchBase(input, regex, options, posix);
8235
8235
  } else {
8236
- match = regex.exec(output);
8236
+ match2 = regex.exec(output);
8237
8237
  }
8238
8238
  }
8239
- return { isMatch: Boolean(match), match, output };
8239
+ return { isMatch: Boolean(match2), match: match2, output };
8240
8240
  };
8241
8241
  picomatch.matchBase = (input, glob, options, posix = utils.isWindows(options)) => {
8242
8242
  const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
@@ -8334,8 +8334,8 @@ var require_micromatch = __commonJS({
8334
8334
  if (negated) negatives++;
8335
8335
  for (let item of list) {
8336
8336
  let matched = isMatch(item, true);
8337
- let match = negated ? !matched.isMatch : matched.isMatch;
8338
- if (!match) continue;
8337
+ let match2 = negated ? !matched.isMatch : matched.isMatch;
8338
+ if (!match2) continue;
8339
8339
  if (negated) {
8340
8340
  omit.add(matched.output);
8341
8341
  } else {
@@ -8431,9 +8431,9 @@ var require_micromatch = __commonJS({
8431
8431
  micromatch.capture = (glob, input, options) => {
8432
8432
  let posix = utils.isWindows(options);
8433
8433
  let regex = picomatch.makeRe(String(glob), { ...options, capture: true });
8434
- let match = regex.exec(posix ? utils.toPosixSlashes(input) : input);
8435
- if (match) {
8436
- return match.slice(1).map((v) => v === void 0 ? "" : v);
8434
+ let match2 = regex.exec(posix ? utils.toPosixSlashes(input) : input);
8435
+ if (match2) {
8436
+ return match2.slice(1).map((v) => v === void 0 ? "" : v);
8437
8437
  }
8438
8438
  };
8439
8439
  micromatch.makeRe = (...args) => picomatch.makeRe(...args);
@@ -10362,7 +10362,7 @@ var require_partial = __commonJS({
10362
10362
  if (!pattern.complete && levels > section.length) {
10363
10363
  return true;
10364
10364
  }
10365
- const match = parts.every((part, index) => {
10365
+ const match2 = parts.every((part, index) => {
10366
10366
  const segment = pattern.segments[index];
10367
10367
  if (segment.dynamic && segment.patternRe.test(part)) {
10368
10368
  return true;
@@ -10372,7 +10372,7 @@ var require_partial = __commonJS({
10372
10372
  }
10373
10373
  return false;
10374
10374
  });
10375
- if (match) {
10375
+ if (match2) {
10376
10376
  return true;
10377
10377
  }
10378
10378
  }
@@ -10988,7 +10988,7 @@ var require_ignore = __commonJS({
10988
10988
  var RETURN_FALSE = () => false;
10989
10989
  var sanitizeRange = (range) => range.replace(
10990
10990
  REGEX_REGEXP_RANGE,
10991
- (match, from, to) => from.charCodeAt(0) <= to.charCodeAt(0) ? match : EMPTY
10991
+ (match2, from, to) => from.charCodeAt(0) <= to.charCodeAt(0) ? match2 : EMPTY
10992
10992
  );
10993
10993
  var cleanRangeBackSlash = (slashes) => {
10994
10994
  const { length } = slashes;
@@ -11040,7 +11040,7 @@ var require_ignore = __commonJS({
11040
11040
  // > These special characters are often called "metacharacters".
11041
11041
  [
11042
11042
  /[\\$.|*+(){^]/g,
11043
- (match) => `\\${match}`
11043
+ (match2) => `\\${match2}`
11044
11044
  ],
11045
11045
  [
11046
11046
  // > a question mark (?) matches a single character
@@ -11122,7 +11122,7 @@ var require_ignore = __commonJS({
11122
11122
  // > can be used to match one of the characters in a range.
11123
11123
  // `\` is escaped by step 3
11124
11124
  /(\\)?\[([^\]/]*?)(\\*)($|\])/g,
11125
- (match, leadEscape, range, endEscape, close) => leadEscape === ESCAPE ? `\\[${range}${cleanRangeBackSlash(endEscape)}${close}` : close === "]" ? endEscape.length % 2 === 0 ? `[${sanitizeRange(range)}${endEscape}]` : "[]" : "[]"
11125
+ (match2, leadEscape, range, endEscape, close) => leadEscape === ESCAPE ? `\\[${range}${cleanRangeBackSlash(endEscape)}${close}` : close === "]" ? endEscape.length % 2 === 0 ? `[${sanitizeRange(range)}${endEscape}]` : "[]" : "[]"
11126
11126
  ],
11127
11127
  // ending
11128
11128
  [
@@ -11139,7 +11139,7 @@ var require_ignore = __commonJS({
11139
11139
  // 'js*' will not match 'a.js'
11140
11140
  // 'js/' will not match 'a.js'
11141
11141
  // 'js' will match 'a.js' and 'a.js/'
11142
- (match) => /\/$/.test(match) ? `${match}$` : `${match}(?=$|\\/$)`
11142
+ (match2) => /\/$/.test(match2) ? `${match2}$` : `${match2}(?=$|\\/$)`
11143
11143
  ]
11144
11144
  ];
11145
11145
  var REGEX_REPLACE_TRAILING_WILDCARD = /(^|\\\/)?\\\*$/;
@@ -11410,6 +11410,878 @@ var require_ignore = __commonJS({
11410
11410
  }
11411
11411
  });
11412
11412
 
11413
+ // ../../node_modules/variant/lib/isType.js
11414
+ var require_isType = __commonJS({
11415
+ "../../node_modules/variant/lib/isType.js"(exports) {
11416
+ "use strict";
11417
+ init_esm_shims();
11418
+ Object.defineProperty(exports, "__esModule", { value: true });
11419
+ exports.isTypeImpl = void 0;
11420
+ function isTypeImpl(key) {
11421
+ function isType2(instanceOrType, type) {
11422
+ if (instanceOrType != void 0) {
11423
+ if (typeof instanceOrType === "function" || typeof instanceOrType === "string") {
11424
+ const typeArg = instanceOrType;
11425
+ const typeStr = typeof typeArg === "string" ? typeArg : typeArg.output.type;
11426
+ return (o) => isType2(o, typeStr);
11427
+ } else {
11428
+ const instance = instanceOrType;
11429
+ const typeStr = typeof type === "string" ? type : type.output.type;
11430
+ return instance != void 0 && instance[key !== null && key !== void 0 ? key : "type"] === typeStr;
11431
+ }
11432
+ } else {
11433
+ return false;
11434
+ }
11435
+ }
11436
+ return { isType: isType2 };
11437
+ }
11438
+ exports.isTypeImpl = isTypeImpl;
11439
+ }
11440
+ });
11441
+
11442
+ // ../../node_modules/variant/lib/util.js
11443
+ var require_util = __commonJS({
11444
+ "../../node_modules/variant/lib/util.js"(exports) {
11445
+ "use strict";
11446
+ init_esm_shims();
11447
+ Object.defineProperty(exports, "__esModule", { value: true });
11448
+ exports.HOI = exports.isPromise = exports.identityFunc = void 0;
11449
+ var identityFunc = (x = {}) => x;
11450
+ exports.identityFunc = identityFunc;
11451
+ function isPromise(x) {
11452
+ return x != void 0 && typeof x === "object" && "then" in x && typeof x.then === "function";
11453
+ }
11454
+ exports.isPromise = isPromise;
11455
+ var HOI = () => (definition) => definition;
11456
+ exports.HOI = HOI;
11457
+ }
11458
+ });
11459
+
11460
+ // ../../node_modules/variant/lib/variant.js
11461
+ var require_variant = __commonJS({
11462
+ "../../node_modules/variant/lib/variant.js"(exports) {
11463
+ "use strict";
11464
+ init_esm_shims();
11465
+ Object.defineProperty(exports, "__esModule", { value: true });
11466
+ exports.variantImpl = exports.isVariantCreator = exports.scopeType = void 0;
11467
+ var util_1 = require_util();
11468
+ var scopeType = (scope, type) => `${scope}/${type}`;
11469
+ exports.scopeType = scopeType;
11470
+ function descopeType(s) {
11471
+ var _a;
11472
+ return (_a = s.split("/")[1]) !== null && _a !== void 0 ? _a : s;
11473
+ }
11474
+ var VARIANT_CREATOR_BRAND = Symbol("Variant Creator");
11475
+ function isVariantCreator(func) {
11476
+ return VARIANT_CREATOR_BRAND in func;
11477
+ }
11478
+ exports.isVariantCreator = isVariantCreator;
11479
+ function variantImpl(key) {
11480
+ function scope(scope2, v) {
11481
+ return Object.keys(v).reduce((acc, key2) => {
11482
+ return Object.assign(Object.assign({}, acc), { [key2]: variation((0, exports.scopeType)(scope2, key2), typeof v[key2] === "function" ? v[key2] : util_1.identityFunc) });
11483
+ }, {});
11484
+ }
11485
+ function descope(obj) {
11486
+ return Object.assign(Object.assign({}, obj), { [key]: descopeType(obj[key]) });
11487
+ }
11488
+ function variation(type, creator) {
11489
+ let maker = (...args) => {
11490
+ const returned = (creator !== null && creator !== void 0 ? creator : util_1.identityFunc)(...args);
11491
+ if ((0, util_1.isPromise)(returned)) {
11492
+ return returned.then((result) => {
11493
+ if (key in (result !== null && result !== void 0 ? result : {})) {
11494
+ return result;
11495
+ } else {
11496
+ return Object.assign(result !== null && result !== void 0 ? result : {}, { [key]: type });
11497
+ }
11498
+ });
11499
+ } else {
11500
+ if (key in (returned !== null && returned !== void 0 ? returned : {})) {
11501
+ return returned;
11502
+ } else {
11503
+ return Object.assign(returned !== null && returned !== void 0 ? returned : {}, { [key]: type });
11504
+ }
11505
+ }
11506
+ };
11507
+ Object.defineProperty(maker, "name", { value: type, writable: false });
11508
+ const outputs = { output: { key, type } };
11509
+ return Object.assign(maker, outputs, {
11510
+ [VARIANT_CREATOR_BRAND]: VARIANT_CREATOR_BRAND,
11511
+ toString: function() {
11512
+ return this.output.type;
11513
+ }
11514
+ });
11515
+ }
11516
+ function variantModule(template) {
11517
+ return Object.entries(template).reduce((result, [vmKey, vmVal]) => {
11518
+ const creator = typeof vmVal === "function" ? isVariantCreator(vmVal) ? vmVal : variation(vmKey, vmVal) : variation(vmKey, util_1.identityFunc);
11519
+ return Object.assign(Object.assign({}, result), { [vmKey]: creator });
11520
+ }, {});
11521
+ }
11522
+ function variantList(template) {
11523
+ return template.map((t) => {
11524
+ if (typeof t === "string") {
11525
+ return variation(t);
11526
+ } else if (typeof t === "function") {
11527
+ return t;
11528
+ }
11529
+ return t;
11530
+ }).reduce((result, t) => {
11531
+ let creator = typeof t === "string" ? variation(t) : t;
11532
+ return Object.assign(Object.assign({}, result), { [creator.output.type]: creator });
11533
+ }, {});
11534
+ }
11535
+ function variant2(template) {
11536
+ if (Array.isArray(template)) {
11537
+ return variantList(template);
11538
+ } else {
11539
+ return variantModule(template);
11540
+ }
11541
+ }
11542
+ return { descope, scoped: scope, variant: variant2, variantList, variantModule, variation };
11543
+ }
11544
+ exports.variantImpl = variantImpl;
11545
+ }
11546
+ });
11547
+
11548
+ // ../../node_modules/variant/lib/precepts.js
11549
+ var require_precepts = __commonJS({
11550
+ "../../node_modules/variant/lib/precepts.js"(exports) {
11551
+ "use strict";
11552
+ init_esm_shims();
11553
+ Object.defineProperty(exports, "__esModule", { value: true });
11554
+ exports.DEFAULT_KEY = void 0;
11555
+ exports.DEFAULT_KEY = "default";
11556
+ }
11557
+ });
11558
+
11559
+ // ../../node_modules/variant/lib/match.js
11560
+ var require_match = __commonJS({
11561
+ "../../node_modules/variant/lib/match.js"(exports) {
11562
+ "use strict";
11563
+ init_esm_shims();
11564
+ Object.defineProperty(exports, "__esModule", { value: true });
11565
+ exports.matchImpl = void 0;
11566
+ var variant_1 = require_variant();
11567
+ var precepts_1 = require_precepts();
11568
+ function matchImpl(key) {
11569
+ const prematch = (_) => (handler) => (instance) => match2(instance, handler);
11570
+ function match2(...args) {
11571
+ var _a, _b;
11572
+ if (args.length === 1) {
11573
+ const [handler] = args;
11574
+ return (instance) => match2(instance, handler);
11575
+ } else if (args.length === 2) {
11576
+ const [instanceOrTypeOrCreator, handlerParam] = args;
11577
+ const instanceOrCreator = typeof instanceOrTypeOrCreator === "string" ? ofLiteral(instanceOrTypeOrCreator) : instanceOrTypeOrCreator;
11578
+ const handler = typeof handlerParam === "function" ? handlerParam(instanceOrCreator) : handlerParam;
11579
+ const tType = instanceOrCreator == void 0 ? void 0 : (0, variant_1.isVariantCreator)(instanceOrCreator) ? instanceOrCreator.output.type : instanceOrCreator[key];
11580
+ if (instanceOrCreator != void 0 && tType !== void 0 && tType in handler) {
11581
+ return (_a = handler[tType]) === null || _a === void 0 ? void 0 : _a.call(handler, instanceOrCreator);
11582
+ } else if (precepts_1.DEFAULT_KEY in handler) {
11583
+ return (_b = handler[precepts_1.DEFAULT_KEY]) === null || _b === void 0 ? void 0 : _b.call(handler, instanceOrCreator);
11584
+ }
11585
+ }
11586
+ }
11587
+ const partial = (h) => () => h;
11588
+ const onLiteral = ofLiteral;
11589
+ function ofLiteral(instance) {
11590
+ return {
11591
+ [key]: instance
11592
+ };
11593
+ }
11594
+ function lookup(handler) {
11595
+ const handlerWithFuncs = Object.keys(handler).reduce((acc, cur) => {
11596
+ return Object.assign(Object.assign({}, acc), { [cur]: () => handler[cur] });
11597
+ }, {});
11598
+ return (_) => handlerWithFuncs;
11599
+ }
11600
+ function otherwise(branches, elseFunc) {
11601
+ return (_) => Object.assign(Object.assign({}, branches), { default: elseFunc });
11602
+ }
11603
+ function withFallback(handler, fallback) {
11604
+ return (_) => Object.assign(Object.assign({}, handler), { default: fallback });
11605
+ }
11606
+ return { match: match2, ofLiteral, onLiteral, otherwise, partial, prematch, lookup, withFallback };
11607
+ }
11608
+ exports.matchImpl = matchImpl;
11609
+ }
11610
+ });
11611
+
11612
+ // ../../node_modules/variant/lib/types.js
11613
+ var require_types = __commonJS({
11614
+ "../../node_modules/variant/lib/types.js"(exports) {
11615
+ "use strict";
11616
+ init_esm_shims();
11617
+ Object.defineProperty(exports, "__esModule", { value: true });
11618
+ exports.typesImpl = void 0;
11619
+ var variant_1 = require_variant();
11620
+ function typesImpl(key) {
11621
+ function types(content) {
11622
+ if (Array.isArray(content)) {
11623
+ if (content.length && (0, variant_1.isVariantCreator)(content[0])) {
11624
+ return content.map((c) => c.output.type);
11625
+ } else {
11626
+ return content.map((c) => c[key]);
11627
+ }
11628
+ } else {
11629
+ return Object.values(content).map((c) => c.output.type);
11630
+ }
11631
+ }
11632
+ function inferTypes(_) {
11633
+ return new Proxy({}, {
11634
+ get: (_2, property) => {
11635
+ return property;
11636
+ }
11637
+ });
11638
+ }
11639
+ return { types, inferTypes };
11640
+ }
11641
+ exports.typesImpl = typesImpl;
11642
+ }
11643
+ });
11644
+
11645
+ // ../../node_modules/variant/lib/flags.js
11646
+ var require_flags = __commonJS({
11647
+ "../../node_modules/variant/lib/flags.js"(exports) {
11648
+ "use strict";
11649
+ init_esm_shims();
11650
+ Object.defineProperty(exports, "__esModule", { value: true });
11651
+ exports.flagsImpl = void 0;
11652
+ function flagsImpl(key) {
11653
+ function flags(flags2) {
11654
+ return flags2.reduce((o, v) => Object.assign(Object.assign({}, o), { [v[key]]: v }), /* @__PURE__ */ Object.create(null));
11655
+ }
11656
+ return { flags };
11657
+ }
11658
+ exports.flagsImpl = flagsImpl;
11659
+ }
11660
+ });
11661
+
11662
+ // ../../node_modules/variant/lib/isOfVariant.js
11663
+ var require_isOfVariant = __commonJS({
11664
+ "../../node_modules/variant/lib/isOfVariant.js"(exports) {
11665
+ "use strict";
11666
+ init_esm_shims();
11667
+ Object.defineProperty(exports, "__esModule", { value: true });
11668
+ exports.isOfVariantImpl = void 0;
11669
+ function isOfVariantImpl(key) {
11670
+ function isOfVariant(...args) {
11671
+ if (args.length === 1) {
11672
+ const [variant2] = args;
11673
+ return (instance) => instance != void 0 && Object.values(variant2).some((vc) => vc.output.type === instance[key]);
11674
+ } else if (args.length === 2) {
11675
+ const [instance, variant2] = args;
11676
+ return instance != void 0 && Object.values(variant2).some((vc) => vc.output.type === instance[key]);
11677
+ }
11678
+ return false;
11679
+ }
11680
+ return { isOfVariant };
11681
+ }
11682
+ exports.isOfVariantImpl = isOfVariantImpl;
11683
+ }
11684
+ });
11685
+
11686
+ // ../../node_modules/variant/lib/remote.js
11687
+ var require_remote = __commonJS({
11688
+ "../../node_modules/variant/lib/remote.js"(exports) {
11689
+ "use strict";
11690
+ init_esm_shims();
11691
+ Object.defineProperty(exports, "__esModule", { value: true });
11692
+ exports.remoteImpl = exports.CompareResult = void 0;
11693
+ var isType_1 = require_isType();
11694
+ var match_1 = require_match();
11695
+ var variant_1 = require_variant();
11696
+ var CompareResult;
11697
+ (function(CompareResult2) {
11698
+ CompareResult2[CompareResult2["Lesser"] = -1] = "Lesser";
11699
+ CompareResult2[CompareResult2["Equal"] = 0] = "Equal";
11700
+ CompareResult2[CompareResult2["Greater"] = 1] = "Greater";
11701
+ })(CompareResult = exports.CompareResult || (exports.CompareResult = {}));
11702
+ function remoteImpl(key) {
11703
+ const { isType: isType2 } = (0, isType_1.isTypeImpl)(key);
11704
+ const { match: match2 } = (0, match_1.matchImpl)(key);
11705
+ const { variantList } = (0, variant_1.variantImpl)(key);
11706
+ function isFunctions(vmod) {
11707
+ const keys = Object.keys(vmod);
11708
+ return keys.reduce((acc, key2) => {
11709
+ return Object.assign(Object.assign({}, acc), { [key2]: isType2(key2) });
11710
+ }, {});
11711
+ }
11712
+ function remote(vmod) {
11713
+ return {
11714
+ key,
11715
+ is: isFunctions(vmod),
11716
+ new: vmod,
11717
+ match: match2
11718
+ };
11719
+ }
11720
+ ;
11721
+ function getType(input) {
11722
+ if (typeof input === "string") {
11723
+ return input;
11724
+ } else if (typeof input === "function") {
11725
+ return input.output.type;
11726
+ } else {
11727
+ return input[key];
11728
+ }
11729
+ }
11730
+ function _sequence(module3, order) {
11731
+ const miniModule = module3;
11732
+ const result = remote(miniModule);
11733
+ const keyOrder = order.map(getType);
11734
+ return Object.assign(Object.assign({}, result), { length: order.length, compare: (a, b) => {
11735
+ const ai = keyOrder.findIndex((i) => i === getType(a));
11736
+ const bi = keyOrder.findIndex((i) => i === getType(b));
11737
+ const diff = ai - bi;
11738
+ return diff === 0 ? diff : diff / Math.abs(diff);
11739
+ }, get(i) {
11740
+ const type = this.types[i];
11741
+ return this.new[type];
11742
+ }, index: (a) => keyOrder.findIndex((i) => i === getType(a)), types: keyOrder });
11743
+ }
11744
+ function _sequenceOfList(order) {
11745
+ const module3 = variantList(order);
11746
+ return _sequence(module3, order);
11747
+ }
11748
+ function sequence(module3, order) {
11749
+ if (Array.isArray(module3)) {
11750
+ return _sequenceOfList(module3);
11751
+ } else {
11752
+ return _sequence(module3, order);
11753
+ }
11754
+ }
11755
+ return { remote, sequence };
11756
+ }
11757
+ exports.remoteImpl = remoteImpl;
11758
+ }
11759
+ });
11760
+
11761
+ // ../../node_modules/variant/lib/typed.js
11762
+ var require_typed = __commonJS({
11763
+ "../../node_modules/variant/lib/typed.js"(exports) {
11764
+ "use strict";
11765
+ init_esm_shims();
11766
+ Object.defineProperty(exports, "__esModule", { value: true });
11767
+ exports.typedImpl = exports.pass = void 0;
11768
+ var pass = (x) => x;
11769
+ exports.pass = pass;
11770
+ function typedImpl(_key) {
11771
+ function typed(defOrFactory) {
11772
+ if (typeof defOrFactory === "function") {
11773
+ return defOrFactory(exports.pass);
11774
+ } else {
11775
+ return defOrFactory;
11776
+ }
11777
+ }
11778
+ return { typed };
11779
+ }
11780
+ exports.typedImpl = typedImpl;
11781
+ }
11782
+ });
11783
+
11784
+ // ../../node_modules/variant/lib/match.tools.js
11785
+ var require_match_tools = __commonJS({
11786
+ "../../node_modules/variant/lib/match.tools.js"(exports) {
11787
+ "use strict";
11788
+ init_esm_shims();
11789
+ Object.defineProperty(exports, "__esModule", { value: true });
11790
+ exports.unpack = exports.just = exports.constant = void 0;
11791
+ function constant(x) {
11792
+ return () => x;
11793
+ }
11794
+ exports.constant = constant;
11795
+ exports.just = constant;
11796
+ var unpack = (x) => x.payload;
11797
+ exports.unpack = unpack;
11798
+ }
11799
+ });
11800
+
11801
+ // ../../node_modules/variant/lib/matcher.js
11802
+ var require_matcher2 = __commonJS({
11803
+ "../../node_modules/variant/lib/matcher.js"(exports) {
11804
+ "use strict";
11805
+ init_esm_shims();
11806
+ Object.defineProperty(exports, "__esModule", { value: true });
11807
+ exports.matcherImpl = exports.Matcher = exports.tableToHandler = void 0;
11808
+ var match_tools_1 = require_match_tools();
11809
+ var variant_1 = require_variant();
11810
+ function tableToHandler(table) {
11811
+ return Object.keys(table).reduce((acc, cur) => {
11812
+ const key = cur;
11813
+ return Object.assign(Object.assign({}, acc), { [key]: (0, match_tools_1.just)(table[key]) });
11814
+ }, {});
11815
+ }
11816
+ exports.tableToHandler = tableToHandler;
11817
+ var Matcher = class _Matcher {
11818
+ /**
11819
+ * Create a new matcher from the target
11820
+ * @param target the
11821
+ * @param handler the initial handler. Use `{}` for standard functionality.
11822
+ * @param key the discriminant. Use `'type'` for standard functionality.
11823
+ */
11824
+ constructor(target, key, handler) {
11825
+ this.target = target;
11826
+ this.key = key;
11827
+ this.handler = handler;
11828
+ this.complete = (options) => {
11829
+ var _a, _b;
11830
+ if (this.target != void 0 && this.target[this.key] in this.handler) {
11831
+ return (_b = (_a = this.handler)[this.target[this.key]]) === null || _b === void 0 ? void 0 : _b.call(_a, this.target);
11832
+ } else {
11833
+ if ((options === null || options === void 0 ? void 0 : options.withFallback) != void 0) {
11834
+ return options.withFallback(this.target);
11835
+ }
11836
+ }
11837
+ };
11838
+ }
11839
+ /**
11840
+ * Immediately execute the matcher. Exhaustiveness is not guaranteed.
11841
+ *
11842
+ * This is a **terminal** and resolves the matcher.
11843
+ */
11844
+ execute() {
11845
+ const chosenHandler = this.handler[this.target[this.key]];
11846
+ return chosenHandler === null || chosenHandler === void 0 ? void 0 : chosenHandler(this.target);
11847
+ }
11848
+ /**
11849
+ * Handle all unhandled cases and immediately execute.
11850
+ *
11851
+ * > **Exhaust** — to consume entirely, _Merriam-Webster_
11852
+ *
11853
+ * This is a **terminal** and resolves the matcher.
11854
+ * @param remainingCases an object wiht a method to handle every remaining case.
11855
+ * @returns the result of executing the handler, given these final additions.
11856
+ */
11857
+ exhaust(remainingCases) {
11858
+ var _a;
11859
+ const combinedHandler = Object.assign(Object.assign({}, this.handler), remainingCases);
11860
+ return (_a = combinedHandler[this.target[this.key]]) === null || _a === void 0 ? void 0 : _a.call(combinedHandler, this.target);
11861
+ }
11862
+ /**
11863
+ * Resolve all remaining cases without executing the matcher.
11864
+ * @param remainingCases
11865
+ * @returns
11866
+ */
11867
+ remaining(remainingCases) {
11868
+ return new _Matcher(this.target, this.key, Object.assign(Object.assign({}, this.handler), remainingCases));
11869
+ }
11870
+ /**
11871
+ * Execute the match. If the target type has been explicitly handled, use that logic.
11872
+ * Otherwise use the function passed here.
11873
+ *
11874
+ * This is a **terminal** and resolves the matcher.
11875
+ * @param func
11876
+ * @returns
11877
+ */
11878
+ else(func) {
11879
+ var _a, _b;
11880
+ if (this.target[this.key] in this.handler) {
11881
+ return (_b = (_a = this.handler)[this.target[this.key]]) === null || _b === void 0 ? void 0 : _b.call(_a, this.target);
11882
+ } else {
11883
+ return func(this.target);
11884
+ }
11885
+ }
11886
+ /**
11887
+ * Register a series of options as a lookup table.
11888
+ *
11889
+ * ```ts
11890
+ * const getSound = (a: Animal) => matcher(a)
11891
+ * .register({
11892
+ * cat: 'purr',
11893
+ * dog: 'woof',
11894
+ * snake: 'hiss',
11895
+ * })
11896
+ * .complete()
11897
+ * ```
11898
+ * @param table
11899
+ * @returns
11900
+ */
11901
+ register(table) {
11902
+ const newHandler = Object.assign(Object.assign({}, this.handler), tableToHandler(table));
11903
+ return new _Matcher(this.target, this.key, newHandler);
11904
+ }
11905
+ /**
11906
+ * Provide an exhaustive table of the unhandled options and look up which value
11907
+ * to use based on the instance.
11908
+ *
11909
+ * This is a **terminal** and resolves the matcher.
11910
+ *
11911
+ * ```ts
11912
+ * const getSound = (a: Animal) => matcher(a)
11913
+ * .lookup({
11914
+ * cat: 'purr',
11915
+ * dog: 'woof',
11916
+ * snake: 'hiss',
11917
+ * })
11918
+ * ```
11919
+ * @param table
11920
+ * @returns
11921
+ */
11922
+ lookup(table) {
11923
+ var _a;
11924
+ const combinedHandler = Object.assign(Object.assign({}, this.handler), tableToHandler(table));
11925
+ return (_a = combinedHandler[this.target[this.key]]) === null || _a === void 0 ? void 0 : _a.call(combinedHandler, this.target);
11926
+ }
11927
+ /**
11928
+ * Handle one or more cases, object-style.
11929
+ * @param variations
11930
+ */
11931
+ with(variations) {
11932
+ return new _Matcher(this.target, this.key, Object.assign(Object.assign({}, this.handler), variations));
11933
+ }
11934
+ // actual implementation
11935
+ when(variations, handler) {
11936
+ if (handler != void 0) {
11937
+ const list = Array.isArray(variations) ? variations : [variations];
11938
+ const newCases = list.reduce((acc, cur) => {
11939
+ const type = typeof cur === "string" ? cur : (0, variant_1.isVariantCreator)(cur) ? cur.output.type : void 0;
11940
+ return type != void 0 ? Object.assign(Object.assign({}, acc), { [type]: handler }) : acc;
11941
+ }, {});
11942
+ return new _Matcher(this.target, this.key, Object.assign(Object.assign({}, this.handler), newCases));
11943
+ } else {
11944
+ return new _Matcher(this.target, this.key, Object.assign(Object.assign({}, this.handler), variations));
11945
+ }
11946
+ }
11947
+ };
11948
+ exports.Matcher = Matcher;
11949
+ function matcherImpl(key) {
11950
+ function matcher(target) {
11951
+ const actualTarget = typeof target === "string" ? { [key]: target } : target;
11952
+ return new Matcher(actualTarget, key, {});
11953
+ }
11954
+ return { matcher };
11955
+ }
11956
+ exports.matcherImpl = matcherImpl;
11957
+ }
11958
+ });
11959
+
11960
+ // ../../node_modules/variant/lib/cosmos.js
11961
+ var require_cosmos = __commonJS({
11962
+ "../../node_modules/variant/lib/cosmos.js"(exports) {
11963
+ "use strict";
11964
+ init_esm_shims();
11965
+ Object.defineProperty(exports, "__esModule", { value: true });
11966
+ exports.variantCosmos = void 0;
11967
+ var isType_1 = require_isType();
11968
+ var match_1 = require_match();
11969
+ var variant_1 = require_variant();
11970
+ var types_1 = require_types();
11971
+ var flags_1 = require_flags();
11972
+ var isOfVariant_1 = require_isOfVariant();
11973
+ var remote_1 = require_remote();
11974
+ var typed_1 = require_typed();
11975
+ var matcher_1 = require_matcher2();
11976
+ function variantCosmos({ key }) {
11977
+ const { isType: isType2 } = (0, isType_1.isTypeImpl)(key);
11978
+ const { flags } = (0, flags_1.flagsImpl)(key);
11979
+ return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({
11980
+ key,
11981
+ isType: isType2,
11982
+ flags
11983
+ }, (0, isOfVariant_1.isOfVariantImpl)(key)), (0, match_1.matchImpl)(key)), (0, matcher_1.matcherImpl)(key)), (0, remote_1.remoteImpl)(key)), (0, typed_1.typedImpl)(key)), (0, types_1.typesImpl)(key)), (0, variant_1.variantImpl)(key));
11984
+ }
11985
+ exports.variantCosmos = variantCosmos;
11986
+ }
11987
+ });
11988
+
11989
+ // ../../node_modules/variant/lib/type/index.js
11990
+ var require_type = __commonJS({
11991
+ "../../node_modules/variant/lib/type/index.js"(exports) {
11992
+ "use strict";
11993
+ init_esm_shims();
11994
+ var _a;
11995
+ Object.defineProperty(exports, "__esModule", { value: true });
11996
+ exports.withFallback = exports.variation = exports.variantModule = exports.variantList = exports.variant = exports.types = exports.typed = exports.lookup = exports.sequence = exports.scoped = exports.remote = exports.prematch = exports.partial = exports.otherwise = exports.onLiteral = exports.ofLiteral = exports.matcher = exports.match = exports.isType = exports.isOfVariant = exports.inferTypes = exports.flags = exports.descope = void 0;
11997
+ var cosmos_1 = require_cosmos();
11998
+ _a = (0, cosmos_1.variantCosmos)({ key: "type" }), exports.descope = _a.descope, exports.flags = _a.flags, exports.inferTypes = _a.inferTypes, exports.isOfVariant = _a.isOfVariant, exports.isType = _a.isType, exports.match = _a.match, exports.matcher = _a.matcher, exports.ofLiteral = _a.ofLiteral, exports.onLiteral = _a.onLiteral, exports.otherwise = _a.otherwise, exports.partial = _a.partial, exports.prematch = _a.prematch, exports.remote = _a.remote, exports.scoped = _a.scoped, exports.sequence = _a.sequence, exports.lookup = _a.lookup, exports.typed = _a.typed, exports.types = _a.types, exports.variant = _a.variant, exports.variantList = _a.variantList, exports.variantModule = _a.variantModule, exports.variation = _a.variation, exports.withFallback = _a.withFallback;
11999
+ }
12000
+ });
12001
+
12002
+ // ../../node_modules/variant/lib/augment.js
12003
+ var require_augment = __commonJS({
12004
+ "../../node_modules/variant/lib/augment.js"(exports) {
12005
+ "use strict";
12006
+ init_esm_shims();
12007
+ Object.defineProperty(exports, "__esModule", { value: true });
12008
+ exports.augment = void 0;
12009
+ var type_1 = require_type();
12010
+ var variant_1 = require_variant();
12011
+ function augment(variantDefinition, f) {
12012
+ return Object.keys(variantDefinition).reduce((acc, key) => {
12013
+ let inputFunc = variantDefinition[key];
12014
+ let returnFunc = (0, variant_1.isVariantCreator)(inputFunc) ? (0, type_1.variation)(inputFunc.output.type, (...args) => {
12015
+ let result = inputFunc(...args);
12016
+ return Object.assign(Object.assign({}, f(result)), result);
12017
+ }) : (...args) => {
12018
+ const branch = variantDefinition[key];
12019
+ let item = typeof branch === "function" ? branch(...args) : {};
12020
+ return Object.assign(Object.assign({}, f(item)), item);
12021
+ };
12022
+ return Object.assign(Object.assign({}, acc), { [key]: returnFunc });
12023
+ }, {});
12024
+ }
12025
+ exports.augment = augment;
12026
+ }
12027
+ });
12028
+
12029
+ // ../../node_modules/variant/lib/constrained.js
12030
+ var require_constrained = __commonJS({
12031
+ "../../node_modules/variant/lib/constrained.js"(exports) {
12032
+ "use strict";
12033
+ init_esm_shims();
12034
+ Object.defineProperty(exports, "__esModule", { value: true });
12035
+ exports.constrained = void 0;
12036
+ function constrained(_constraint_, v) {
12037
+ return v;
12038
+ }
12039
+ exports.constrained = constrained;
12040
+ }
12041
+ });
12042
+
12043
+ // ../../node_modules/variant/lib/construct.js
12044
+ var require_construct = __commonJS({
12045
+ "../../node_modules/variant/lib/construct.js"(exports) {
12046
+ "use strict";
12047
+ init_esm_shims();
12048
+ Object.defineProperty(exports, "__esModule", { value: true });
12049
+ exports.construct = void 0;
12050
+ function construct(cls) {
12051
+ return (...args) => new cls(args);
12052
+ }
12053
+ exports.construct = construct;
12054
+ }
12055
+ });
12056
+
12057
+ // ../../node_modules/variant/lib/generic.js
12058
+ var require_generic = __commonJS({
12059
+ "../../node_modules/variant/lib/generic.js"(exports) {
12060
+ "use strict";
12061
+ init_esm_shims();
12062
+ Object.defineProperty(exports, "__esModule", { value: true });
12063
+ exports.Alpha = exports.onTerms = void 0;
12064
+ var flags_1 = require_flags();
12065
+ var variant_1 = require_variant();
12066
+ var GENERIC_BRAND = Symbol("VARIANT GENERIC TEMPLATE");
12067
+ function onTerms(func) {
12068
+ return Object.assign(Object.assign({}, func(exports.Alpha)), { [GENERIC_BRAND]: void 0 });
12069
+ }
12070
+ exports.onTerms = onTerms;
12071
+ var GTERM = "__term";
12072
+ var genericTerms = (0, variant_1.variantImpl)(GTERM).variant;
12073
+ var flags = (0, flags_1.flagsImpl)(GTERM).flags;
12074
+ var GP = genericTerms([
12075
+ "A",
12076
+ "B",
12077
+ "C",
12078
+ "D",
12079
+ "E",
12080
+ "F",
12081
+ "G",
12082
+ "H",
12083
+ "I",
12084
+ "J",
12085
+ "K",
12086
+ "L",
12087
+ "M",
12088
+ "N",
12089
+ "O",
12090
+ "P",
12091
+ "Q",
12092
+ "R",
12093
+ "S",
12094
+ "T",
12095
+ "U",
12096
+ "V",
12097
+ "W",
12098
+ "X",
12099
+ "Y",
12100
+ "Z"
12101
+ ]);
12102
+ exports.Alpha = flags(Object.values(GP).map((f) => f()));
12103
+ }
12104
+ });
12105
+
12106
+ // ../../node_modules/variant/lib/typeCatalog.js
12107
+ var require_typeCatalog = __commonJS({
12108
+ "../../node_modules/variant/lib/typeCatalog.js"(exports) {
12109
+ "use strict";
12110
+ init_esm_shims();
12111
+ Object.defineProperty(exports, "__esModule", { value: true });
12112
+ exports.typeMap = exports.typeCatalog = void 0;
12113
+ function typeCatalog(variant2) {
12114
+ return Object.values(variant2).reduce((result, vc) => {
12115
+ return Object.assign(Object.assign({}, result), { [vc.output.type]: vc.output.type });
12116
+ }, {});
12117
+ }
12118
+ exports.typeCatalog = typeCatalog;
12119
+ function typeMap(variant2) {
12120
+ return Object.keys(variant2).reduce((result, key) => {
12121
+ return Object.assign(Object.assign({}, result), { [key]: variant2[key].output.type });
12122
+ }, {});
12123
+ }
12124
+ exports.typeMap = typeMap;
12125
+ }
12126
+ });
12127
+
12128
+ // ../../node_modules/variant/lib/catalog.js
12129
+ var require_catalog = __commonJS({
12130
+ "../../node_modules/variant/lib/catalog.js"(exports) {
12131
+ "use strict";
12132
+ init_esm_shims();
12133
+ Object.defineProperty(exports, "__esModule", { value: true });
12134
+ exports.literalist = exports.catalog = void 0;
12135
+ function catalog(catalog2, factory) {
12136
+ if (Array.isArray(catalog2)) {
12137
+ return catalog2.reduce((result, current, index) => {
12138
+ return Object.assign(Object.assign({}, result), { [current]: factory != void 0 ? factory(current, index) : current });
12139
+ }, {});
12140
+ } else {
12141
+ return catalog2;
12142
+ }
12143
+ }
12144
+ exports.catalog = catalog;
12145
+ exports.literalist = catalog;
12146
+ }
12147
+ });
12148
+
12149
+ // ../../node_modules/variant/lib/patterned.js
12150
+ var require_patterned = __commonJS({
12151
+ "../../node_modules/variant/lib/patterned.js"(exports) {
12152
+ "use strict";
12153
+ init_esm_shims();
12154
+ Object.defineProperty(exports, "__esModule", { value: true });
12155
+ exports.patterned = void 0;
12156
+ function patterned(_constraint_, v) {
12157
+ return v;
12158
+ }
12159
+ exports.patterned = patterned;
12160
+ }
12161
+ });
12162
+
12163
+ // ../../node_modules/variant/lib/variant.tools.js
12164
+ var require_variant_tools = __commonJS({
12165
+ "../../node_modules/variant/lib/variant.tools.js"(exports) {
12166
+ "use strict";
12167
+ init_esm_shims();
12168
+ Object.defineProperty(exports, "__esModule", { value: true });
12169
+ exports.nil = exports.payload = exports.fields = void 0;
12170
+ function fields2(defaults = {}) {
12171
+ return (...args) => {
12172
+ const [arg] = args;
12173
+ return Object.assign(Object.assign({}, defaults), arg);
12174
+ };
12175
+ }
12176
+ exports.fields = fields2;
12177
+ function payload(_example) {
12178
+ return (payload2) => ({ payload: payload2 });
12179
+ }
12180
+ exports.payload = payload;
12181
+ var nil = () => ({});
12182
+ exports.nil = nil;
12183
+ }
12184
+ });
12185
+
12186
+ // ../../node_modules/variant/lib/slim.js
12187
+ var require_slim = __commonJS({
12188
+ "../../node_modules/variant/lib/slim.js"(exports) {
12189
+ "use strict";
12190
+ init_esm_shims();
12191
+ Object.defineProperty(exports, "__esModule", { value: true });
12192
+ exports.payload = exports.nil = exports.fields = exports.HOI = exports.pass = exports.patterned = exports.unpack = exports.just = exports.constant = exports.literalist = exports.catalog = exports.typeCatalog = exports.typeMap = exports.onTerms = exports.variantCosmos = exports.construct = exports.constrained = exports.augment = void 0;
12193
+ var augment_1 = require_augment();
12194
+ Object.defineProperty(exports, "augment", { enumerable: true, get: function() {
12195
+ return augment_1.augment;
12196
+ } });
12197
+ var constrained_1 = require_constrained();
12198
+ Object.defineProperty(exports, "constrained", { enumerable: true, get: function() {
12199
+ return constrained_1.constrained;
12200
+ } });
12201
+ var construct_1 = require_construct();
12202
+ Object.defineProperty(exports, "construct", { enumerable: true, get: function() {
12203
+ return construct_1.construct;
12204
+ } });
12205
+ var cosmos_1 = require_cosmos();
12206
+ Object.defineProperty(exports, "variantCosmos", { enumerable: true, get: function() {
12207
+ return cosmos_1.variantCosmos;
12208
+ } });
12209
+ var generic_1 = require_generic();
12210
+ Object.defineProperty(exports, "onTerms", { enumerable: true, get: function() {
12211
+ return generic_1.onTerms;
12212
+ } });
12213
+ var typeCatalog_1 = require_typeCatalog();
12214
+ Object.defineProperty(exports, "typeMap", { enumerable: true, get: function() {
12215
+ return typeCatalog_1.typeMap;
12216
+ } });
12217
+ Object.defineProperty(exports, "typeCatalog", { enumerable: true, get: function() {
12218
+ return typeCatalog_1.typeCatalog;
12219
+ } });
12220
+ var catalog_1 = require_catalog();
12221
+ Object.defineProperty(exports, "catalog", { enumerable: true, get: function() {
12222
+ return catalog_1.catalog;
12223
+ } });
12224
+ Object.defineProperty(exports, "literalist", { enumerable: true, get: function() {
12225
+ return catalog_1.literalist;
12226
+ } });
12227
+ var match_tools_1 = require_match_tools();
12228
+ Object.defineProperty(exports, "constant", { enumerable: true, get: function() {
12229
+ return match_tools_1.constant;
12230
+ } });
12231
+ Object.defineProperty(exports, "just", { enumerable: true, get: function() {
12232
+ return match_tools_1.just;
12233
+ } });
12234
+ Object.defineProperty(exports, "unpack", { enumerable: true, get: function() {
12235
+ return match_tools_1.unpack;
12236
+ } });
12237
+ var patterned_1 = require_patterned();
12238
+ Object.defineProperty(exports, "patterned", { enumerable: true, get: function() {
12239
+ return patterned_1.patterned;
12240
+ } });
12241
+ var typed_1 = require_typed();
12242
+ Object.defineProperty(exports, "pass", { enumerable: true, get: function() {
12243
+ return typed_1.pass;
12244
+ } });
12245
+ var util_1 = require_util();
12246
+ Object.defineProperty(exports, "HOI", { enumerable: true, get: function() {
12247
+ return util_1.HOI;
12248
+ } });
12249
+ var variant_tools_1 = require_variant_tools();
12250
+ Object.defineProperty(exports, "fields", { enumerable: true, get: function() {
12251
+ return variant_tools_1.fields;
12252
+ } });
12253
+ Object.defineProperty(exports, "nil", { enumerable: true, get: function() {
12254
+ return variant_tools_1.nil;
12255
+ } });
12256
+ Object.defineProperty(exports, "payload", { enumerable: true, get: function() {
12257
+ return variant_tools_1.payload;
12258
+ } });
12259
+ }
12260
+ });
12261
+
12262
+ // ../../node_modules/variant/lib/index.js
12263
+ var require_lib = __commonJS({
12264
+ "../../node_modules/variant/lib/index.js"(exports) {
12265
+ "use strict";
12266
+ init_esm_shims();
12267
+ var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
12268
+ if (k2 === void 0) k2 = k;
12269
+ Object.defineProperty(o, k2, { enumerable: true, get: function() {
12270
+ return m[k];
12271
+ } });
12272
+ } : function(o, m, k, k2) {
12273
+ if (k2 === void 0) k2 = k;
12274
+ o[k2] = m[k];
12275
+ });
12276
+ var __exportStar = exports && exports.__exportStar || function(m, exports2) {
12277
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding(exports2, m, p);
12278
+ };
12279
+ Object.defineProperty(exports, "__esModule", { value: true });
12280
+ __exportStar(require_slim(), exports);
12281
+ __exportStar(require_type(), exports);
12282
+ }
12283
+ });
12284
+
11413
12285
  // src/index.ts
11414
12286
  init_esm_shims();
11415
12287
  var import_chokidar = __toESM(require_chokidar(), 1);
@@ -11461,9 +12333,9 @@ var reDetectIndentation = /(?:\r\n|\r|\n)([ \t]*)(?:[^ \t\r\n]|$)/;
11461
12333
  var reOnlyWhitespaceWithAtLeastOneNewline = /^[ \t]*[\r\n][ \t\r\n]*$/;
11462
12334
  function _outdentArray(strings, firstInterpolatedValueSetsIndentationLevel, options) {
11463
12335
  var indentationLevel = 0;
11464
- var match = strings[0].match(reDetectIndentation);
11465
- if (match) {
11466
- indentationLevel = match[1].length;
12336
+ var match2 = strings[0].match(reDetectIndentation);
12337
+ if (match2) {
12338
+ indentationLevel = match2[1].length;
11467
12339
  }
11468
12340
  var reSource = "(\\r\\n|\\r|\\n).{0," + indentationLevel + "}";
11469
12341
  var reMatchIndent = new RegExp(reSource, "g");
@@ -12104,6 +12976,26 @@ var generateGlobTasks = normalizeArguments(generateTasks);
12104
12976
  var generateGlobTasksSync = normalizeArgumentsSync(generateTasksSync);
12105
12977
  var { convertPathToPattern } = import_fast_glob2.default;
12106
12978
 
12979
+ // src/components.ts
12980
+ init_esm_shims();
12981
+ var import_variant = __toESM(require_lib(), 1);
12982
+ var Component = (0, import_variant.variant)({
12983
+ BackofficeExtensionMenuPlugin: (0, import_variant.fields)(),
12984
+ BackofficeExtensionWidget: (0, import_variant.fields)(),
12985
+ BackofficeModal: (0, import_variant.fields)(),
12986
+ BackofficePage: (0, import_variant.fields)(),
12987
+ EcomAdditionalFees: (0, import_variant.fields)(),
12988
+ EcomDiscountsTrigger: (0, import_variant.fields)(),
12989
+ EcomGiftCardsProvider: (0, import_variant.fields)(),
12990
+ EcomPaymentSettings: (0, import_variant.fields)(),
12991
+ EcomShippingRates: (0, import_variant.fields)(),
12992
+ EcomValidations: (0, import_variant.fields)(),
12993
+ Webhook: (0, import_variant.fields)()
12994
+ });
12995
+ var UnknownComponent = (0, import_variant.variant)({
12996
+ Unknown: (0, import_variant.fields)()
12997
+ });
12998
+
12107
12999
  // src/schemas.ts
12108
13000
  init_esm_shims();
12109
13001
 
@@ -16169,13 +17061,13 @@ var z = /* @__PURE__ */ Object.freeze({
16169
17061
  });
16170
17062
 
16171
17063
  // src/schemas.ts
16172
- var baseComponentSchema = z.object({
17064
+ var baseDevCenterComponentSchema = z.object({
16173
17065
  compData: z.unknown(),
16174
17066
  compId: z.string(),
16175
17067
  compName: z.string().optional(),
16176
17068
  compType: z.string()
16177
17069
  }).passthrough();
16178
- var webhookSchema = baseComponentSchema.merge(
17070
+ var devCenterWebhookSchema = baseDevCenterComponentSchema.merge(
16179
17071
  z.object({
16180
17072
  compData: z.object({
16181
17073
  webhook: z.object({
@@ -16185,7 +17077,7 @@ var webhookSchema = baseComponentSchema.merge(
16185
17077
  compType: z.literal("WEBHOOK")
16186
17078
  })
16187
17079
  );
16188
- var backofficeExtensionWidgetSchema = baseComponentSchema.merge(
17080
+ var devCenterBackofficeExtensionWidgetSchema = baseDevCenterComponentSchema.merge(
16189
17081
  z.object({
16190
17082
  compData: z.object({
16191
17083
  backOfficeExtensionWidget: z.object({
@@ -16195,17 +17087,15 @@ var backofficeExtensionWidgetSchema = baseComponentSchema.merge(
16195
17087
  compType: z.literal("BACK_OFFICE_EXTENSION_WIDGET")
16196
17088
  })
16197
17089
  );
16198
- var backofficeExtensionMenuPluginSchema = baseComponentSchema.merge(
17090
+ var devCenterBackofficeExtensionMenuPluginSchema = baseDevCenterComponentSchema.merge(
16199
17091
  z.object({
16200
17092
  compData: z.object({
16201
- backOfficeExtensionMenuItem: z.object({
16202
- iframeUrl: z.string().optional()
16203
- }).passthrough()
17093
+ backOfficeExtensionMenuItem: z.unknown().optional()
16204
17094
  }),
16205
17095
  compType: z.literal("BACK_OFFICE_EXTENSION_MENU_ITEM")
16206
17096
  })
16207
17097
  );
16208
- var backofficeModalSchema = baseComponentSchema.merge(
17098
+ var devCenterBackofficeModalSchema = baseDevCenterComponentSchema.merge(
16209
17099
  z.object({
16210
17100
  compData: z.object({
16211
17101
  backOfficeModal: z.object({
@@ -16215,7 +17105,7 @@ var backofficeModalSchema = baseComponentSchema.merge(
16215
17105
  compType: z.literal("BACK_OFFICE_MODAL")
16216
17106
  })
16217
17107
  );
16218
- var backofficePageSchema = baseComponentSchema.merge(
17108
+ var devCenterBackofficePageSchema = baseDevCenterComponentSchema.merge(
16219
17109
  z.object({
16220
17110
  compData: z.object({
16221
17111
  backOfficePage: z.object({
@@ -16225,7 +17115,7 @@ var backofficePageSchema = baseComponentSchema.merge(
16225
17115
  compType: z.literal("BACK_OFFICE_PAGE")
16226
17116
  })
16227
17117
  );
16228
- var ecomAdditionalFeesSchema = baseComponentSchema.merge(
17118
+ var devCenterEcomAdditionalFeesSchema = baseDevCenterComponentSchema.merge(
16229
17119
  z.object({
16230
17120
  compData: z.object({
16231
17121
  ecomAdditionalFees: z.object({
@@ -16235,7 +17125,7 @@ var ecomAdditionalFeesSchema = baseComponentSchema.merge(
16235
17125
  compType: z.literal("ECOM_ADDITIONAL_FEES")
16236
17126
  })
16237
17127
  );
16238
- var ecomDiscountsTriggerSchema = baseComponentSchema.merge(
17128
+ var devCenterEcomDiscountsTriggerSchema = baseDevCenterComponentSchema.merge(
16239
17129
  z.object({
16240
17130
  compData: z.object({
16241
17131
  ecomDiscountsTrigger: z.object({
@@ -16245,7 +17135,7 @@ var ecomDiscountsTriggerSchema = baseComponentSchema.merge(
16245
17135
  compType: z.literal("ECOM_DISCOUNTS_TRIGGER")
16246
17136
  })
16247
17137
  );
16248
- var ecomPaymentSettingsSchema = baseComponentSchema.merge(
17138
+ var devCenterEcomPaymentSettingsSchema = baseDevCenterComponentSchema.merge(
16249
17139
  z.object({
16250
17140
  compData: z.object({
16251
17141
  ecomPaymentSettings: z.object({
@@ -16255,7 +17145,7 @@ var ecomPaymentSettingsSchema = baseComponentSchema.merge(
16255
17145
  compType: z.literal("ECOM_PAYMENT_SETTINGS")
16256
17146
  })
16257
17147
  );
16258
- var ecomShippingRatesSchema = baseComponentSchema.merge(
17148
+ var devCenterEcomShippingRatesSchema = baseDevCenterComponentSchema.merge(
16259
17149
  z.object({
16260
17150
  compData: z.object({
16261
17151
  ecomShippingRates: z.object({
@@ -16265,7 +17155,7 @@ var ecomShippingRatesSchema = baseComponentSchema.merge(
16265
17155
  compType: z.literal("ECOM_SHIPPING_RATES")
16266
17156
  })
16267
17157
  );
16268
- var ecomValidationsSchema = baseComponentSchema.merge(
17158
+ var devCenterEcomValidationsSchema = baseDevCenterComponentSchema.merge(
16269
17159
  z.object({
16270
17160
  compData: z.object({
16271
17161
  ecomValidations: z.object({
@@ -16275,7 +17165,7 @@ var ecomValidationsSchema = baseComponentSchema.merge(
16275
17165
  compType: z.literal("ECOM_VALIDATIONS")
16276
17166
  })
16277
17167
  );
16278
- var ecomGiftCardsProviderSchema = baseComponentSchema.merge(
17168
+ var devCenterEcomGiftCardsProviderSchema = baseDevCenterComponentSchema.merge(
16279
17169
  z.object({
16280
17170
  compData: z.object({
16281
17171
  giftCardsProvider: z.object({
@@ -16285,18 +17175,18 @@ var ecomGiftCardsProviderSchema = baseComponentSchema.merge(
16285
17175
  compType: z.literal("GIFT_CARDS_PROVIDER")
16286
17176
  })
16287
17177
  );
16288
- var componentSchema = z.discriminatedUnion("compType", [
16289
- backofficePageSchema,
16290
- backofficeExtensionWidgetSchema,
16291
- backofficeExtensionMenuPluginSchema,
16292
- backofficeModalSchema,
16293
- webhookSchema,
16294
- ecomAdditionalFeesSchema,
16295
- ecomShippingRatesSchema,
16296
- ecomDiscountsTriggerSchema,
16297
- ecomValidationsSchema,
16298
- ecomPaymentSettingsSchema,
16299
- ecomGiftCardsProviderSchema
17178
+ var devCenterComponentSchema = z.discriminatedUnion("compType", [
17179
+ devCenterBackofficePageSchema,
17180
+ devCenterBackofficeExtensionWidgetSchema,
17181
+ devCenterBackofficeExtensionMenuPluginSchema,
17182
+ devCenterBackofficeModalSchema,
17183
+ devCenterWebhookSchema,
17184
+ devCenterEcomAdditionalFeesSchema,
17185
+ devCenterEcomShippingRatesSchema,
17186
+ devCenterEcomDiscountsTriggerSchema,
17187
+ devCenterEcomValidationsSchema,
17188
+ devCenterEcomPaymentSettingsSchema,
17189
+ devCenterEcomGiftCardsProviderSchema
16300
17190
  ]);
16301
17191
 
16302
17192
  // src/utils/fs-utils.ts
@@ -16861,45 +17751,113 @@ function loadEnvVars(rootDir, logger) {
16861
17751
  async function createProjectModel(logger) {
16862
17752
  const rootDir = cwd();
16863
17753
  const { appId, env: env2 } = loadEnvVars(rootDir, logger);
16864
- const extensionsPaths = await globby(join2(EXTENSIONS_DIR, "*"), {
17754
+ const componentsPaths = await globby(join2(EXTENSIONS_DIR, "*"), {
16865
17755
  cwd: rootDir,
16866
17756
  onlyDirectories: true
16867
17757
  });
16868
- const extensions = [];
16869
- const unknownExtensions = [];
16870
- for (const extensionPath of extensionsPaths) {
16871
- const extensionManifest = await readExtensionManifest(extensionPath);
16872
- const knownAppManifest = await parseKnownExtensionManifest(extensionManifest);
16873
- if (knownAppManifest != null) {
16874
- extensions.push({
16875
- cwd: extensionPath,
16876
- manifest: knownAppManifest
16877
- });
17758
+ const components = [];
17759
+ const unknownComponents = [];
17760
+ for (const componentPath of componentsPaths) {
17761
+ const extensionManifest = await readExtensionManifest(componentPath);
17762
+ const knownManifest = await parseKnownExtensionManifest(extensionManifest);
17763
+ if (knownManifest != null) {
17764
+ components.push(createComponent(knownManifest, componentPath));
16878
17765
  continue;
16879
17766
  }
16880
- const unknownAppManifest = await parseBaseExtensionManifest(extensionManifest);
16881
- unknownExtensions.push({
16882
- cwd: extensionPath,
16883
- manifest: unknownAppManifest
16884
- });
17767
+ const unknownManifest = await parseBaseExtensionManifest(extensionManifest);
17768
+ unknownComponents.push(
17769
+ UnknownComponent.Unknown({
17770
+ directory: componentPath,
17771
+ manifest: unknownManifest
17772
+ })
17773
+ );
16885
17774
  }
16886
17775
  return {
16887
17776
  appId,
17777
+ components,
16888
17778
  env: env2,
16889
- extensions,
16890
17779
  rootDir,
16891
- unknownExtensions
17780
+ unknownComponents
16892
17781
  };
16893
17782
  }
17783
+ function createComponent(manifest, directory) {
17784
+ switch (manifest.compType) {
17785
+ case "BACK_OFFICE_EXTENSION_MENU_ITEM":
17786
+ return Component.BackofficeExtensionMenuPlugin({
17787
+ directory,
17788
+ manifest
17789
+ });
17790
+ case "BACK_OFFICE_EXTENSION_WIDGET": {
17791
+ return Component.BackofficeExtensionWidget({
17792
+ directory,
17793
+ manifest
17794
+ });
17795
+ }
17796
+ case "BACK_OFFICE_MODAL": {
17797
+ return Component.BackofficeModal({
17798
+ directory,
17799
+ manifest
17800
+ });
17801
+ }
17802
+ case "BACK_OFFICE_PAGE": {
17803
+ return Component.BackofficePage({
17804
+ directory,
17805
+ manifest
17806
+ });
17807
+ }
17808
+ case "ECOM_ADDITIONAL_FEES": {
17809
+ return Component.EcomAdditionalFees({
17810
+ directory,
17811
+ manifest
17812
+ });
17813
+ }
17814
+ case "ECOM_DISCOUNTS_TRIGGER": {
17815
+ return Component.EcomDiscountsTrigger({
17816
+ directory,
17817
+ manifest
17818
+ });
17819
+ }
17820
+ case "ECOM_PAYMENT_SETTINGS": {
17821
+ return Component.EcomPaymentSettings({
17822
+ directory,
17823
+ manifest
17824
+ });
17825
+ }
17826
+ case "ECOM_SHIPPING_RATES": {
17827
+ return Component.EcomShippingRates({
17828
+ directory,
17829
+ manifest
17830
+ });
17831
+ }
17832
+ case "ECOM_VALIDATIONS": {
17833
+ return Component.EcomValidations({
17834
+ directory,
17835
+ manifest
17836
+ });
17837
+ }
17838
+ case "GIFT_CARDS_PROVIDER": {
17839
+ return Component.EcomGiftCardsProvider({
17840
+ directory,
17841
+ manifest
17842
+ });
17843
+ }
17844
+ case "WEBHOOK": {
17845
+ return Component.Webhook({
17846
+ directory,
17847
+ manifest
17848
+ });
17849
+ }
17850
+ }
17851
+ }
16894
17852
  async function parseKnownExtensionManifest(extensionManifest) {
16895
- const appManifestResult = componentSchema.safeParse(extensionManifest);
17853
+ const appManifestResult = devCenterComponentSchema.safeParse(extensionManifest);
16896
17854
  if (appManifestResult.error) {
16897
17855
  return null;
16898
17856
  }
16899
17857
  return appManifestResult.data;
16900
17858
  }
16901
17859
  async function parseBaseExtensionManifest(extensionManifest) {
16902
- const appManifestResult = baseComponentSchema.safeParse(extensionManifest);
17860
+ const appManifestResult = baseDevCenterComponentSchema.safeParse(extensionManifest);
16903
17861
  if (!appManifestResult.success) {
16904
17862
  throw new Error(defaultOutdent`
16905
17863
  Invalid extension configuration:
@@ -16920,21 +17878,10 @@ async function readExtensionManifest(directoryPath) {
16920
17878
  // src/utils/generateAppManifest.ts
16921
17879
  init_esm_shims();
16922
17880
  function generateAppManifest(model) {
16923
- const extensions = model.extensions.map((extension) => extension.manifest).map((manifest) => {
17881
+ const extensions = model.components.map((component) => component.manifest).map((manifest) => {
16924
17882
  switch (manifest.compType) {
16925
17883
  case "BACK_OFFICE_EXTENSION_MENU_ITEM":
16926
- if (manifest.compData.backOfficeExtensionMenuItem.iframeUrl) {
16927
- return manifest;
16928
- }
16929
- return {
16930
- ...manifest,
16931
- compData: {
16932
- backOfficeExtensionMenuItem: {
16933
- ...manifest.compData.backOfficeExtensionMenuItem,
16934
- iframeUrl: `_wix/extensions/backoffice/${manifest.compId}`
16935
- }
16936
- }
16937
- };
17884
+ return manifest;
16938
17885
  case "BACK_OFFICE_EXTENSION_WIDGET":
16939
17886
  if (manifest.compData.backOfficeExtensionWidget.iframeUrl) {
16940
17887
  return manifest;
@@ -17069,8 +18016,8 @@ function generateAppManifest(model) {
17069
18016
  return manifest;
17070
18017
  }
17071
18018
  });
17072
- const unknownExtensions = model.unknownExtensions.map(
17073
- (extension) => extension.manifest
18019
+ const unknownExtensions = model.unknownComponents.map(
18020
+ (component) => component.manifest
17074
18021
  );
17075
18022
  return {
17076
18023
  appId: model.appId,
@@ -17081,51 +18028,62 @@ function generateAppManifest(model) {
17081
18028
  // src/utils/isValidBackofficeComponent.ts
17082
18029
  init_esm_shims();
17083
18030
  function isValidBackofficeComponent(component) {
17084
- return component.compType === "BACK_OFFICE_PAGE" && !component.compData.backOfficePage.iframeUrl || component.compType === "BACK_OFFICE_EXTENSION_WIDGET" && !component.compData.backOfficeExtensionWidget.iframeUrl || component.compType === "BACK_OFFICE_EXTENSION_MENU_ITEM" && !component.compData.backOfficeExtensionMenuItem.iframeUrl || component.compType === "BACK_OFFICE_MODAL" && !component.compData.backOfficeModal.iframeUrl;
18031
+ return component.type === "BackofficePage" && !component.manifest.compData.backOfficePage.iframeUrl || component.type === "BackofficeExtensionWidget" && !component.manifest.compData.backOfficeExtensionWidget.iframeUrl || component.type === "BackofficeModal" && !component.manifest.compData.backOfficeModal.iframeUrl;
17085
18032
  }
17086
18033
 
17087
18034
  // src/utils/isValidServicePluginComponent.ts
17088
18035
  init_esm_shims();
17089
18036
  function isValidServicePluginComponent(component) {
17090
- return component.compType === "ECOM_SHIPPING_RATES" && !component.compData.ecomShippingRates.deploymentUri || component.compType === "ECOM_ADDITIONAL_FEES" && !component.compData.ecomAdditionalFees.deploymentUri || component.compType === "ECOM_DISCOUNTS_TRIGGER" && !component.compData.ecomDiscountsTrigger.deploymentUri || component.compType === "ECOM_VALIDATIONS" && !component.compData.ecomValidations.deploymentUri || component.compType === "ECOM_PAYMENT_SETTINGS" && !component.compData.ecomPaymentSettings.deploymentUri || component.compType === "GIFT_CARDS_PROVIDER" && !component.compData.giftCardsProvider.deploymentUri;
18037
+ return component.type === "EcomShippingRates" && !component.manifest.compData.ecomShippingRates.deploymentUri || component.type === "EcomAdditionalFees" && !component.manifest.compData.ecomAdditionalFees.deploymentUri || component.type === "EcomDiscountsTrigger" && !component.manifest.compData.ecomDiscountsTrigger.deploymentUri || component.type === "EcomValidations" && !component.manifest.compData.ecomValidations.deploymentUri || component.type === "EcomPaymentSettings" && !component.manifest.compData.ecomPaymentSettings.deploymentUri || component.type === "EcomGiftCardsProvider" && !component.manifest.compData.giftCardsProvider.deploymentUri;
17091
18038
  }
17092
18039
 
17093
18040
  // src/utils/isValidWebhookComponent.ts
17094
18041
  init_esm_shims();
17095
18042
  function isValidWebhookComponent(component) {
17096
- return component.compType === "WEBHOOK" && !component.compData.webhook.callbackUrl;
18043
+ return component.type === "Webhook" && !component.manifest.compData.webhook.callbackUrl;
18044
+ }
18045
+
18046
+ // src/utils/resolveBuildMetadata.ts
18047
+ init_esm_shims();
18048
+ async function resolveBuildMetadata(appManifestPath, config) {
18049
+ const clientDir = await pathExists(config.build.client.pathname) ? config.build.client.pathname : config.outDir.pathname;
18050
+ const serverDir = await pathExists(config.build.server.pathname) ? config.build.server.pathname : void 0;
18051
+ return {
18052
+ appManifestPath,
18053
+ clientDir,
18054
+ outDir: config.outDir.pathname,
18055
+ serverDir
18056
+ };
17097
18057
  }
17098
18058
 
17099
18059
  // src/utils/writeVirtualBackofficeExtensionFiles.ts
17100
18060
  init_esm_shims();
17101
18061
  import { rm, writeFile as writeFile2 } from "node:fs/promises";
17102
18062
  import { join as join3, resolve } from "node:path";
18063
+ var import_variant2 = __toESM(require_lib(), 1);
17103
18064
  async function writeVirtualBackofficeExtensionFiles(model, codegenDir) {
17104
- const backofficeExtensions = model.extensions.filter(
17105
- (extension) => isValidBackofficeComponent(extension.manifest)
18065
+ const backofficeComponents = model.components.filter(
18066
+ isValidBackofficeComponent
17106
18067
  );
17107
18068
  const existingFiles = await globby(`*.astro`, {
17108
18069
  cwd: codegenDir,
17109
18070
  onlyFiles: true
17110
18071
  });
17111
18072
  for (const filename of existingFiles) {
17112
- const hasMatchingSourceFile = backofficeExtensions.some(
17113
- (extension) => `${extension.manifest.compId}.astro` === filename
18073
+ const hasMatchingSourceFile = backofficeComponents.some(
18074
+ (component) => `${component.manifest.compId}.astro` === filename
17114
18075
  );
17115
18076
  if (hasMatchingSourceFile) {
17116
18077
  continue;
17117
18078
  }
17118
18079
  await rm(join3(codegenDir, filename));
17119
18080
  }
17120
- for (const extension of backofficeExtensions) {
17121
- const originalEntrypoint = resolve(
17122
- model.rootDir,
17123
- extension.cwd,
17124
- "page.tsx"
17125
- );
18081
+ for (const component of backofficeComponents) {
18082
+ const entryFilename = resolveEntry(component);
18083
+ const originalEntrypoint = resolve(model.rootDir, entryFilename);
17126
18084
  const virtualEntrypoint = join3(
17127
18085
  codegenDir,
17128
- `${extension.manifest.compId}.astro`
18086
+ `${component.manifest.compId}.astro`
17129
18087
  );
17130
18088
  await writeFile2(
17131
18089
  virtualEntrypoint,
@@ -17141,33 +18099,41 @@ async function writeVirtualBackofficeExtensionFiles(model, codegenDir) {
17141
18099
  );
17142
18100
  }
17143
18101
  }
18102
+ function resolveEntry(component) {
18103
+ const entryName = (0, import_variant2.match)(component, {
18104
+ BackofficeExtensionWidget: () => "widget.tsx",
18105
+ BackofficeModal: () => "modal.tsx",
18106
+ BackofficePage: () => "page.tsx"
18107
+ });
18108
+ return join3(component.directory, entryName);
18109
+ }
17144
18110
 
17145
18111
  // src/utils/writeVirtualServicePluginExtensionFiles.ts
17146
18112
  init_esm_shims();
17147
18113
  import { rm as rm2, writeFile as writeFile3 } from "node:fs/promises";
17148
18114
  import { join as join4, resolve as resolve2 } from "node:path";
17149
18115
  async function writeVirtualServicePluginExtensionFiles(model, codegenDir) {
17150
- const servicePluginExtensions = model.extensions.filter(
17151
- (extension) => isValidServicePluginComponent(extension.manifest)
18116
+ const servicePluginComponents = model.components.filter(
18117
+ isValidServicePluginComponent
17152
18118
  );
17153
18119
  const existingFiles = await globby(`*.ts`, {
17154
18120
  cwd: codegenDir,
17155
18121
  onlyFiles: true
17156
18122
  });
17157
18123
  for (const filename of existingFiles) {
17158
- const hasMatchingSourceFile = servicePluginExtensions.some(
17159
- (extension) => `${extension.manifest.compId}.ts` === filename
18124
+ const hasMatchingSourceFile = servicePluginComponents.some(
18125
+ (component) => `${component.manifest.compId}.ts` === filename
17160
18126
  );
17161
18127
  if (hasMatchingSourceFile) {
17162
18128
  continue;
17163
18129
  }
17164
18130
  await rm2(join4(codegenDir, filename));
17165
18131
  }
17166
- for (const extension of servicePluginExtensions) {
17167
- const originalEntrypoint = resolve2(extension.cwd, "plugin.ts");
18132
+ for (const component of servicePluginComponents) {
18133
+ const originalEntrypoint = resolve2(component.directory, "plugin.ts");
17168
18134
  const virtualEntrypoint = join4(
17169
18135
  codegenDir,
17170
- `${extension.manifest.compId}.ts`
18136
+ `${component.manifest.compId}.ts`
17171
18137
  );
17172
18138
  await writeFile3(
17173
18139
  virtualEntrypoint,
@@ -17208,27 +18174,25 @@ init_esm_shims();
17208
18174
  import { rm as rm3, writeFile as writeFile4 } from "node:fs/promises";
17209
18175
  import { join as join5, resolve as resolve3 } from "node:path";
17210
18176
  async function writeVirtualWebhookExtensionFiles(model, codegenDir) {
17211
- const webhookExtensions = model.extensions.filter(
17212
- (extension) => isValidWebhookComponent(extension.manifest)
17213
- );
18177
+ const webhookComponents = model.components.filter(isValidWebhookComponent);
17214
18178
  const existingFiles = await globby(`*.ts`, {
17215
18179
  cwd: codegenDir,
17216
18180
  onlyFiles: true
17217
18181
  });
17218
18182
  for (const filename of existingFiles) {
17219
- const hasMatchingSourceFile = webhookExtensions.some(
17220
- (extension) => `${extension.manifest.compId}.ts` === filename
18183
+ const hasMatchingSourceFile = webhookComponents.some(
18184
+ (component) => `${component.manifest.compId}.ts` === filename
17221
18185
  );
17222
18186
  if (hasMatchingSourceFile) {
17223
18187
  continue;
17224
18188
  }
17225
18189
  await rm3(join5(codegenDir, filename));
17226
18190
  }
17227
- for (const extension of webhookExtensions) {
17228
- const originalEntrypoint = resolve3(extension.cwd, "event.ts");
18191
+ for (const component of webhookComponents) {
18192
+ const originalEntrypoint = resolve3(component.directory, "event.ts");
17229
18193
  const virtualEntrypoint = join5(
17230
18194
  codegenDir,
17231
- `${extension.manifest.compId}.ts`
18195
+ `${component.manifest.compId}.ts`
17232
18196
  );
17233
18197
  await writeFile4(
17234
18198
  virtualEntrypoint,
@@ -17281,12 +18245,8 @@ var createIntegration = () => {
17281
18245
  await writeJson(appManifestPath, appManifest, { spaces: 2 });
17282
18246
  await writeJson(
17283
18247
  join6(_config.root.pathname, GIT_IGNORED_DIR, "build-metadata.json"),
17284
- {
17285
- appManifestPath,
17286
- clientDir: _config.build.client.pathname,
17287
- outDir: _config.outDir.pathname,
17288
- serverDir: _config.build.server.pathname
17289
- }
18248
+ await resolveBuildMetadata(appManifestPath, _config),
18249
+ { spaces: 2 }
17290
18250
  );
17291
18251
  },
17292
18252
  "astro:config:done": async ({ config }) => {
@@ -17415,17 +18375,17 @@ var createIntegration = () => {
17415
18375
  await writeVirtualWebhookExtensionFiles(model, webhookCodegenDir);
17416
18376
  });
17417
18377
  } else {
17418
- const webhookExtensions = model.extensions.filter(
17419
- (extension) => isValidWebhookComponent(extension.manifest)
18378
+ const webhookComponents = model.components.filter(
18379
+ isValidWebhookComponent
17420
18380
  );
17421
- for (const extension of webhookExtensions) {
18381
+ for (const component of webhookComponents) {
17422
18382
  const virtualEntrypoint = join6(
17423
18383
  webhookCodegenDir,
17424
- `${extension.manifest.compId}.ts`
18384
+ `${component.manifest.compId}.ts`
17425
18385
  );
17426
18386
  injectRoute({
17427
18387
  entrypoint: virtualEntrypoint,
17428
- pattern: `/_wix/extensions/webhooks/${extension.manifest.compId}`
18388
+ pattern: `/_wix/extensions/webhooks/${component.manifest.compId}`
17429
18389
  });
17430
18390
  }
17431
18391
  }
@@ -17456,17 +18416,17 @@ var createIntegration = () => {
17456
18416
  );
17457
18417
  });
17458
18418
  } else {
17459
- const servicePluginExtensions = model.extensions.filter(
17460
- (extension) => isValidServicePluginComponent(extension.manifest)
18419
+ const servicePluginComponents = model.components.filter(
18420
+ isValidServicePluginComponent
17461
18421
  );
17462
- for (const extension of servicePluginExtensions) {
18422
+ for (const component of servicePluginComponents) {
17463
18423
  const virtualEntrypoint = join6(
17464
18424
  servicePluginCodegenDir,
17465
- `${extension.manifest.compId}.ts`
18425
+ `${component.manifest.compId}.ts`
17466
18426
  );
17467
18427
  injectRoute({
17468
18428
  entrypoint: virtualEntrypoint,
17469
- pattern: `/_wix/extensions/service-plugins/${extension.manifest.compId}`
18429
+ pattern: `/_wix/extensions/service-plugins/${component.manifest.compId}`
17470
18430
  });
17471
18431
  }
17472
18432
  }
@@ -17494,17 +18454,17 @@ var createIntegration = () => {
17494
18454
  );
17495
18455
  });
17496
18456
  } else {
17497
- const backofficeExtensions = model.extensions.filter(
17498
- (extension) => isValidBackofficeComponent(extension.manifest)
18457
+ const backofficeComponents = model.components.filter(
18458
+ isValidBackofficeComponent
17499
18459
  );
17500
- for (const extension of backofficeExtensions) {
18460
+ for (const component of backofficeComponents) {
17501
18461
  const virtualEntrypoint = join6(
17502
18462
  backofficeCodegenDir,
17503
- `${extension.manifest.compId}.astro`
18463
+ `${component.manifest.compId}.astro`
17504
18464
  );
17505
18465
  injectRoute({
17506
18466
  entrypoint: virtualEntrypoint,
17507
- pattern: `/_wix/extensions/backoffice/${extension.manifest.compId}`
18467
+ pattern: `/_wix/extensions/backoffice/${component.manifest.compId}`
17508
18468
  });
17509
18469
  }
17510
18470
  }