@wix/astro 1.0.35 → 1.0.36

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.
Files changed (74) hide show
  1. package/build/index.js +2 -173
  2. package/build/index.js.map +1 -1
  3. package/build-browser-runtime/setup.js +57 -27
  4. package/build-runtime/{chunk-HDTWPOIV.js → chunk-NKFV7KCT.js} +44 -24
  5. package/build-runtime/context/elevated.js +1 -1
  6. package/build-runtime/context/nonElevated.js +1 -1
  7. package/package.json +6 -13
  8. package/src/client-context/setup.ts +14 -0
  9. package/src/client-context/utils.ts +59 -0
  10. package/src/components.ts +98 -0
  11. package/src/constants.ts +2 -0
  12. package/src/context/elevated.ts +20 -0
  13. package/src/context/hostProxy.ts +38 -0
  14. package/src/context/nonElevated.ts +42 -0
  15. package/src/context/setupServicePlugin.ts +13 -0
  16. package/src/context/setupWebhook.ts +13 -0
  17. package/src/context/utils.ts +32 -0
  18. package/src/directories.ts +5 -0
  19. package/src/env.d.ts +11 -0
  20. package/src/index.ts +302 -0
  21. package/src/middleware/auth.ts +38 -0
  22. package/src/middleware/html-embeds.ts +59 -0
  23. package/src/plugins/patchAstroInlineScripts.ts +27 -0
  24. package/src/plugins/patchGlobal.ts +20 -0
  25. package/src/plugins/setupSsrContext.ts +77 -0
  26. package/src/routes/auth/callback.ts +51 -0
  27. package/src/routes/auth/login.ts +42 -0
  28. package/src/routes/auth/logout-callback.ts +18 -0
  29. package/src/routes/auth/logout.ts +28 -0
  30. package/src/routes/paylink/checkout.ts +28 -0
  31. package/src/routes/paylink/paylink.ts +33 -0
  32. package/src/routes/robots/robots.ts +40 -0
  33. package/src/routes/servicePluginsDevRoute.ts +10 -0
  34. package/src/routes/webhooksDevRoute.ts +10 -0
  35. package/src/routes/wix-apis/api.ts +31 -0
  36. package/src/schemas.ts +227 -0
  37. package/src/types.ts +9 -0
  38. package/src/utils/authAsyncLocalStorage.ts +7 -0
  39. package/src/utils/buildBackofficeComponent.ts +64 -0
  40. package/src/utils/buildComponents.ts +182 -0
  41. package/src/utils/buildServicePluginComponent.ts +52 -0
  42. package/src/utils/buildWebhookComponent.ts +39 -0
  43. package/src/utils/contextualAuth.ts +4 -0
  44. package/src/utils/createProjectModel.ts +190 -0
  45. package/src/utils/fs-utils.ts +48 -0
  46. package/src/utils/generateAppManifest.ts +177 -0
  47. package/src/utils/generateVisitorTokens.ts +11 -0
  48. package/src/utils/getSessionTokensFromCookie.ts +38 -0
  49. package/src/utils/loadEnvVars.ts +47 -0
  50. package/src/utils/normalizeWixRedirectUrl.ts +11 -0
  51. package/src/utils/removeUnusedCodegenFiles.ts +34 -0
  52. package/src/utils/resolveBuildMetadata.ts +37 -0
  53. package/src/utils/saveSessionTokensToCookie.ts +27 -0
  54. package/src/utils/transformStreamUtils.ts +39 -0
  55. package/tsconfig.json +9 -0
  56. package/tsup.config.mjs +89 -0
  57. package/build/fsevents-X6WP4TKM.node +0 -0
  58. package/build-runtime/auth.d.ts +0 -5
  59. package/build-runtime/auth.js +0 -3557
  60. package/build-runtime/chunk-24J7STEA.js +0 -8
  61. package/build-runtime/chunk-B6RICTPP.js +0 -94
  62. package/build-runtime/chunk-C3QOE2TZ.js +0 -7
  63. package/build-runtime/chunk-FR26HCAT.js +0 -471
  64. package/build-runtime/chunk-MLKGABMK.js +0 -9
  65. package/build-runtime/chunk-RKE6XT5Z.js +0 -3104
  66. package/build-runtime/chunk-VMS3NKCF.js +0 -18
  67. package/build-runtime/chunk-WYNC47R3.js +0 -7
  68. package/build-runtime/chunk-YMZMZCBN.js +0 -4063
  69. package/build-runtime/context/non-elevated.d.ts +0 -2
  70. package/build-runtime/context/non-elevated.js +0 -32
  71. package/build-runtime/routes/service-plugins.d.ts +0 -5
  72. package/build-runtime/routes/service-plugins.js +0 -11
  73. package/build-runtime/routes/webhooks.d.ts +0 -5
  74. package/build-runtime/routes/webhooks.js +0 -11
package/build/index.js CHANGED
@@ -5529,177 +5529,6 @@ var require_nodefs_handler = __commonJS({
5529
5529
  }
5530
5530
  });
5531
5531
 
5532
- // ../../node_modules/fsevents/fsevents.node
5533
- var fsevents_default;
5534
- var init_fsevents = __esm({
5535
- "../../node_modules/fsevents/fsevents.node"() {
5536
- fsevents_default = "./fsevents-X6WP4TKM.node";
5537
- }
5538
- });
5539
-
5540
- // node-file:/Users/dorch/code/picasso-effort/wix-cli-one/node_modules/fsevents/fsevents.node
5541
- var require_fsevents = __commonJS({
5542
- "node-file:/Users/dorch/code/picasso-effort/wix-cli-one/node_modules/fsevents/fsevents.node"(exports, module2) {
5543
- "use strict";
5544
- init_esm_shims();
5545
- init_fsevents();
5546
- try {
5547
- module2.exports = __require(fsevents_default);
5548
- } catch {
5549
- }
5550
- }
5551
- });
5552
-
5553
- // ../../node_modules/fsevents/vfs.js
5554
- var require_vfs = __commonJS({
5555
- "../../node_modules/fsevents/vfs.js"(exports, module2) {
5556
- "use strict";
5557
- init_esm_shims();
5558
- var path4 = __require("path");
5559
- var pnpApi = null;
5560
- try {
5561
- pnpApi = __require("pnpapi");
5562
- } catch {
5563
- }
5564
- function getVirtualLookupFn(pnpApi2) {
5565
- const reverseMap = /* @__PURE__ */ new Map();
5566
- for (const locator of pnpApi2.getAllLocators()) {
5567
- const pkg = pnpApi2.getPackageInformation(locator);
5568
- console.assert(pkg, `The package information should be available`);
5569
- const resolvedLocation = pnpApi2.resolveVirtual(pkg.packageLocation);
5570
- if (resolvedLocation === null)
5571
- continue;
5572
- const aliases = reverseMap.get(resolvedLocation) || [resolvedLocation];
5573
- reverseMap.set(resolvedLocation, aliases);
5574
- aliases.push(pkg.packageLocation);
5575
- }
5576
- const keys = [...reverseMap.keys()].sort((a, b) => {
5577
- return b.length - a.length;
5578
- });
5579
- return (p) => {
5580
- const prefix = keys.find((candidate) => p.startsWith(candidate));
5581
- if (typeof prefix === `undefined`)
5582
- return [p];
5583
- const sub = p.substr(prefix.length);
5584
- return reverseMap.get(prefix).map((alias) => {
5585
- return alias + sub;
5586
- });
5587
- };
5588
- }
5589
- if (pnpApi != null) {
5590
- const resolveVirtualAliases = getVirtualLookupFn(pnpApi);
5591
- module2.exports = class FsePnp {
5592
- constructor(p) {
5593
- this.normalizedPath = path4.resolve(p);
5594
- this.resolvedPath = pnpApi.resolveVirtual(this.normalizedPath) || this.normalizedPath;
5595
- }
5596
- transpose(p) {
5597
- if (this.resolvedPath !== null) {
5598
- return this.normalizedPath + p.substr(this.resolvedPath.length);
5599
- } else {
5600
- return p;
5601
- }
5602
- }
5603
- wrap(fn) {
5604
- return (path5, ...args) => {
5605
- for (const entry of resolveVirtualAliases(path5)) {
5606
- fn(this.transpose(entry), ...args);
5607
- }
5608
- };
5609
- }
5610
- };
5611
- } else {
5612
- module2.exports = class FsePnp {
5613
- constructor(p) {
5614
- this.resolvedPath = p;
5615
- }
5616
- wrap(fn) {
5617
- return fn;
5618
- }
5619
- };
5620
- }
5621
- }
5622
- });
5623
-
5624
- // ../../node_modules/fsevents/fsevents.js
5625
- var require_fsevents2 = __commonJS({
5626
- "../../node_modules/fsevents/fsevents.js"(exports) {
5627
- "use strict";
5628
- init_esm_shims();
5629
- if (process.platform !== "darwin") {
5630
- throw new Error(`Module 'fsevents' is not compatible with platform '${process.platform}'`);
5631
- }
5632
- var Native = require_fsevents();
5633
- var events = Native.constants;
5634
- function watch(path4, since, handler) {
5635
- if (typeof path4 !== "string") {
5636
- throw new TypeError(`fsevents argument 1 must be a string and not a ${typeof path4}`);
5637
- }
5638
- if ("function" === typeof since && "undefined" === typeof handler) {
5639
- handler = since;
5640
- since = Native.flags.SinceNow;
5641
- }
5642
- if (typeof since !== "number") {
5643
- throw new TypeError(`fsevents argument 2 must be a number and not a ${typeof since}`);
5644
- }
5645
- if (typeof handler !== "function") {
5646
- throw new TypeError(`fsevents argument 3 must be a function and not a ${typeof handler}`);
5647
- }
5648
- let VFS = require_vfs();
5649
- let vfs = new VFS(path4);
5650
- let instance = Native.start(Native.global, vfs.resolvedPath, since, vfs.wrap(handler));
5651
- if (!instance) throw new Error(`could not watch: ${path4}`);
5652
- return () => {
5653
- const result = instance ? Promise.resolve(instance).then(Native.stop) : Promise.resolve(void 0);
5654
- instance = void 0;
5655
- return result;
5656
- };
5657
- }
5658
- function getInfo(path4, flags) {
5659
- return {
5660
- path: path4,
5661
- flags,
5662
- event: getEventType(flags),
5663
- type: getFileType(flags),
5664
- changes: getFileChanges(flags)
5665
- };
5666
- }
5667
- function getFileType(flags) {
5668
- if (events.ItemIsFile & flags) return "file";
5669
- if (events.ItemIsDir & flags) return "directory";
5670
- if (events.MustScanSubDirs & flags) return "directory";
5671
- if (events.ItemIsSymlink & flags) return "symlink";
5672
- }
5673
- function anyIsTrue(obj) {
5674
- for (let key in obj) {
5675
- if (obj[key]) return true;
5676
- }
5677
- return false;
5678
- }
5679
- function getEventType(flags) {
5680
- if (events.ItemRemoved & flags) return "deleted";
5681
- if (events.ItemRenamed & flags) return "moved";
5682
- if (events.ItemCreated & flags) return "created";
5683
- if (events.ItemModified & flags) return "modified";
5684
- if (events.RootChanged & flags) return "root-changed";
5685
- if (events.ItemCloned & flags) return "cloned";
5686
- if (anyIsTrue(flags)) return "modified";
5687
- return "unknown";
5688
- }
5689
- function getFileChanges(flags) {
5690
- return {
5691
- inode: !!(events.ItemInodeMetaMod & flags),
5692
- finder: !!(events.ItemFinderInfoMod & flags),
5693
- access: !!(events.ItemChangeOwner & flags),
5694
- xattrs: !!(events.ItemXattrMod & flags)
5695
- };
5696
- }
5697
- exports.watch = watch;
5698
- exports.getInfo = getInfo;
5699
- exports.constants = events;
5700
- }
5701
- });
5702
-
5703
5532
  // ../../node_modules/chokidar/lib/fsevents-handler.js
5704
5533
  var require_fsevents_handler = __commonJS({
5705
5534
  "../../node_modules/chokidar/lib/fsevents-handler.js"(exports, module2) {
@@ -5710,7 +5539,7 @@ var require_fsevents_handler = __commonJS({
5710
5539
  var { promisify: promisify2 } = __require("util");
5711
5540
  var fsevents;
5712
5541
  try {
5713
- fsevents = require_fsevents2();
5542
+ fsevents = __require("fsevents");
5714
5543
  } catch (error2) {
5715
5544
  if (process.env.CHOKIDAR_PRINT_FSEVENTS_REQUIRE_ERROR) console.error(error2);
5716
5545
  }
@@ -16680,7 +16509,7 @@ function loadEnvVars({
16680
16509
  logger,
16681
16510
  rootDir
16682
16511
  }) {
16683
- const env2 = loadEnv("development", rootDir, "");
16512
+ const env2 = loadEnv("production", rootDir, "");
16684
16513
  const appId = env2[wixClientIdEnvVar];
16685
16514
  if (appId == null) {
16686
16515
  logger.error(