@wix/astro 1.0.16 → 1.0.18
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.d.ts +3 -1
- package/build/index.js +62 -10
- package/build/index.js.map +1 -1
- package/build-browser-runtime/{chunk-HJBVRKIZ.js → setup.js} +13 -5
- package/build-runtime/chunk-C3QOE2TZ.js +7 -0
- package/build-runtime/chunk-HVACFX6T.js +18 -0
- package/build-runtime/chunk-UZPSWWI5.js +13 -0
- package/build-runtime/chunk-YMZMZCBN.js +4063 -0
- package/build-runtime/context/non-elevated.js +26 -14
- package/build-runtime/middleware/auth.js +6 -18
- package/build-runtime/routes/auth/callback.d.ts +5 -0
- package/build-runtime/routes/auth/callback.js +48 -0
- package/build-runtime/routes/auth/login.d.ts +5 -0
- package/build-runtime/routes/auth/login.js +38 -0
- package/build-runtime/routes/auth/logout-callback.d.ts +5 -0
- package/build-runtime/routes/auth/logout-callback.js +20 -0
- package/build-runtime/routes/auth/logout.d.ts +5 -0
- package/build-runtime/routes/auth/logout.js +17 -0
- package/package.json +8 -6
- package/src/constants.ts +2 -0
- package/src/context/non-elevated.ts +31 -9
- package/src/context/setup.ts +14 -0
- package/src/context/utils.ts +0 -4
- package/src/directories.ts +1 -1
- package/src/env.d.ts +2 -0
- package/src/index.ts +48 -4
- package/src/plugins/setupSsrContext.ts +9 -7
- package/src/routes/auth/callback.ts +49 -0
- package/src/routes/auth/login.ts +35 -0
- package/src/routes/auth/logout-callback.ts +16 -0
- package/src/routes/auth/logout.ts +14 -0
- package/src/utils/contextualAuth.ts +4 -0
- package/src/utils/writeVirtualBackofficeExtensionFiles.ts +18 -2
- package/tsup.config.mjs +13 -7
- package/build-browser-runtime/before-hydration.js +0 -24
- package/build-browser-runtime/page.d.ts +0 -5
- package/build-browser-runtime/page.js +0 -14
- package/src/context/before-hydration.ts +0 -21
- package/src/context/page.ts +0 -7
- /package/build-browser-runtime/{before-hydration.d.ts → setup.d.ts} +0 -0
package/build/index.d.ts
CHANGED
package/build/index.js
CHANGED
|
@@ -12471,8 +12471,7 @@ function patchGlobal() {
|
|
|
12471
12471
|
// src/plugins/setupSsrContext.ts
|
|
12472
12472
|
init_esm_shims();
|
|
12473
12473
|
import { extname, join as join2 } from "node:path";
|
|
12474
|
-
function setupSsrContext(
|
|
12475
|
-
const srcDir = join2(rootDir, SRC_DIR);
|
|
12474
|
+
function setupSsrContext() {
|
|
12476
12475
|
const nonElevatedSetupUrl = new URL(
|
|
12477
12476
|
"../build-runtime/context/non-elevated.js",
|
|
12478
12477
|
import.meta.url
|
|
@@ -12487,10 +12486,14 @@ function setupSsrContext(rootDir) {
|
|
|
12487
12486
|
},
|
|
12488
12487
|
name: "setup-ssr-context",
|
|
12489
12488
|
transform(code, id) {
|
|
12490
|
-
|
|
12489
|
+
const extension = extname(id);
|
|
12490
|
+
if (
|
|
12491
|
+
// ignore node_modules
|
|
12492
|
+
id.includes("node_modules") && // but allow injected runtime
|
|
12493
|
+
!id.includes(join2("node_modules", "@wix", "astro"))
|
|
12494
|
+
) {
|
|
12491
12495
|
return null;
|
|
12492
12496
|
}
|
|
12493
|
-
const extension = extname(id);
|
|
12494
12497
|
if (extension !== ".js" && extension !== ".astro" && extension !== ".ts" && extension !== ".tsx") {
|
|
12495
12498
|
return null;
|
|
12496
12499
|
}
|
|
@@ -18152,6 +18155,19 @@ async function writeVirtualBackofficeExtensionFiles(model, codegenDir) {
|
|
|
18152
18155
|
for (const component of backofficeComponents) {
|
|
18153
18156
|
const entryFilename = resolveEntry(component);
|
|
18154
18157
|
const originalEntrypoint = resolve(model.rootDir, entryFilename);
|
|
18158
|
+
const virtualHocEntrypoint = join4(
|
|
18159
|
+
codegenDir,
|
|
18160
|
+
`hoc_${component.manifest.compId}.tsx`
|
|
18161
|
+
);
|
|
18162
|
+
await writeFile2(
|
|
18163
|
+
virtualHocEntrypoint,
|
|
18164
|
+
defaultOutdent`
|
|
18165
|
+
import Component from '${toRelativePath2(virtualHocEntrypoint, originalEntrypoint)}';
|
|
18166
|
+
import { withContextualWixClient } from '@wix/dashboard/internal';
|
|
18167
|
+
|
|
18168
|
+
export const WrappedComponent = withContextualWixClient(Component);
|
|
18169
|
+
`
|
|
18170
|
+
);
|
|
18155
18171
|
const virtualEntrypoint = join4(
|
|
18156
18172
|
codegenDir,
|
|
18157
18173
|
`${component.manifest.compId}.astro`
|
|
@@ -18160,11 +18176,11 @@ async function writeVirtualBackofficeExtensionFiles(model, codegenDir) {
|
|
|
18160
18176
|
virtualEntrypoint,
|
|
18161
18177
|
defaultOutdent`
|
|
18162
18178
|
---
|
|
18163
|
-
import
|
|
18179
|
+
import { WrappedComponent } from '${toRelativePath2(virtualEntrypoint, virtualHocEntrypoint)}';
|
|
18164
18180
|
---
|
|
18165
18181
|
|
|
18166
18182
|
<div>
|
|
18167
|
-
<
|
|
18183
|
+
<WrappedComponent client:only="react" />
|
|
18168
18184
|
</div>
|
|
18169
18185
|
`
|
|
18170
18186
|
);
|
|
@@ -18301,7 +18317,9 @@ async function writeVirtualWebhookExtensionFiles(model, codegenDir) {
|
|
|
18301
18317
|
}
|
|
18302
18318
|
|
|
18303
18319
|
// src/index.ts
|
|
18304
|
-
var createIntegration = (
|
|
18320
|
+
var createIntegration = (options = {
|
|
18321
|
+
enableAuthRoutes: true
|
|
18322
|
+
}) => {
|
|
18305
18323
|
let _config;
|
|
18306
18324
|
let model = null;
|
|
18307
18325
|
return {
|
|
@@ -18340,7 +18358,7 @@ var createIntegration = () => {
|
|
|
18340
18358
|
"before-hydration",
|
|
18341
18359
|
defaultOutdent`
|
|
18342
18360
|
import { WIX_CLIENT_ID } from 'astro:env/client';
|
|
18343
|
-
import { setup } from '@wix/astro/context/
|
|
18361
|
+
import { setup } from '@wix/astro/context/setup';
|
|
18344
18362
|
|
|
18345
18363
|
setup({ clientId: WIX_CLIENT_ID });
|
|
18346
18364
|
`
|
|
@@ -18349,7 +18367,7 @@ var createIntegration = () => {
|
|
|
18349
18367
|
"page",
|
|
18350
18368
|
defaultOutdent`
|
|
18351
18369
|
import { WIX_CLIENT_ID } from 'astro:env/client';
|
|
18352
|
-
import { setup } from '@wix/astro/context/
|
|
18370
|
+
import { setup } from '@wix/astro/context/setup';
|
|
18353
18371
|
|
|
18354
18372
|
setup({ clientId: WIX_CLIENT_ID });
|
|
18355
18373
|
`
|
|
@@ -18390,10 +18408,44 @@ var createIntegration = () => {
|
|
|
18390
18408
|
plugins: [
|
|
18391
18409
|
patchGlobal(),
|
|
18392
18410
|
patchAstroInlineScripts(),
|
|
18393
|
-
setupSsrContext(
|
|
18411
|
+
setupSsrContext()
|
|
18394
18412
|
]
|
|
18395
18413
|
}
|
|
18396
18414
|
});
|
|
18415
|
+
if (options.enableAuthRoutes) {
|
|
18416
|
+
injectRoute({
|
|
18417
|
+
entrypoint: new URL(
|
|
18418
|
+
"../build-runtime/routes/auth/login.js",
|
|
18419
|
+
import.meta.url
|
|
18420
|
+
),
|
|
18421
|
+
pattern: "/api/auth/login",
|
|
18422
|
+
prerender: false
|
|
18423
|
+
});
|
|
18424
|
+
injectRoute({
|
|
18425
|
+
entrypoint: new URL(
|
|
18426
|
+
"../build-runtime/routes/auth/logout.js",
|
|
18427
|
+
import.meta.url
|
|
18428
|
+
),
|
|
18429
|
+
pattern: "/api/auth/logout",
|
|
18430
|
+
prerender: false
|
|
18431
|
+
});
|
|
18432
|
+
injectRoute({
|
|
18433
|
+
entrypoint: new URL(
|
|
18434
|
+
"../build-runtime/routes/auth/callback.js",
|
|
18435
|
+
import.meta.url
|
|
18436
|
+
),
|
|
18437
|
+
pattern: "/api/auth/callback",
|
|
18438
|
+
prerender: false
|
|
18439
|
+
});
|
|
18440
|
+
injectRoute({
|
|
18441
|
+
entrypoint: new URL(
|
|
18442
|
+
"../build-runtime/routes/auth/logout-callback.js",
|
|
18443
|
+
import.meta.url
|
|
18444
|
+
),
|
|
18445
|
+
pattern: "/api/auth/logout-callback",
|
|
18446
|
+
prerender: false
|
|
18447
|
+
});
|
|
18448
|
+
}
|
|
18397
18449
|
const webhookCodegenDir = join7(codegenDir, "extensions/webhooks");
|
|
18398
18450
|
await outputDir(webhookCodegenDir);
|
|
18399
18451
|
if (command === "dev") {
|