@wix/astro 2.11.0 → 2.12.0
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/CHANGELOG.md +319 -0
- package/build/dependencies/astro-backend-extensions/{index.d.ts → types/index.d.ts} +15 -3
- package/build/dependencies/astro-backoffice-extensions/{index.d.ts → types/index.d.ts} +22 -1
- package/build/dependencies/astro-core/{index.d.ts → types/index.d.ts} +17 -6
- package/build/dependencies/astro-custom-elements-extensions/browser-runtime/customElementHmr.d.ts +6 -0
- package/build/dependencies/astro-custom-elements-extensions/browser-runtime/{index.js → customElementHmr.js} +3 -32
- package/build/dependencies/astro-custom-elements-extensions/browser-runtime/reactHmr.d.ts +1 -0
- package/build/dependencies/astro-custom-elements-extensions/browser-runtime/reactHmr.js +26 -0
- package/build/dependencies/astro-custom-elements-extensions/browser-runtime/renderSettingsPanel.d.ts +5 -0
- package/build/dependencies/astro-custom-elements-extensions/browser-runtime/renderSettingsPanel.js +23 -0
- package/build/dependencies/astro-custom-elements-extensions/browser-runtime/wrapCustomElement.d.ts +6 -0
- package/build/dependencies/astro-custom-elements-extensions/browser-runtime/wrapCustomElement.js +30 -0
- package/build/dependencies/astro-custom-elements-extensions/types/index.d.ts +27 -0
- package/build/dependencies/astro-embedded-scripts-extensions/{index.d.ts → types/index.d.ts} +2 -2
- package/build/dependencies/astro-site-component-panels-extensions/types/index.d.ts +21 -0
- package/build/dependencies/astro-site-components-extensions/types/index.d.ts +36 -0
- package/build/dependencies/astro-site-plugins-extensions/{index.d.ts → types/index.d.ts} +5 -3
- package/build/integration/builders.d.ts +322 -8
- package/build/integration/builders.js +12 -9
- package/build/integration/builders.js.map +1 -1
- package/build/integration/{chunk-OJIGUJIG.js → chunk-UBCQK5ZU.js} +1431 -323
- package/build/integration/chunk-UBCQK5ZU.js.map +1 -0
- package/build/integration/index.d.ts +1 -1
- package/build/integration/index.js +16 -28
- package/build/integration/index.js.map +1 -1
- package/package.json +6 -3
- package/build/builders.d.ts +0 -6
- package/build/builders.js +0 -42
- package/build/builders.js.map +0 -1
- package/build/dependencies/astro-auth/index.d.ts +0 -7
- package/build/dependencies/astro-auth/index.js +0 -301
- package/build/dependencies/astro-auth/index.js.map +0 -1
- package/build/dependencies/astro-backend-extensions/index.js +0 -7279
- package/build/dependencies/astro-backend-extensions/index.js.map +0 -1
- package/build/dependencies/astro-backoffice-extensions/index.js +0 -7159
- package/build/dependencies/astro-backoffice-extensions/index.js.map +0 -1
- package/build/dependencies/astro-core/index.js +0 -1055
- package/build/dependencies/astro-core/index.js.map +0 -1
- package/build/dependencies/astro-custom-elements-extensions/browser-runtime/index.d.ts +0 -11
- package/build/dependencies/astro-custom-elements-extensions/index.d.ts +0 -24
- package/build/dependencies/astro-custom-elements-extensions/index.js +0 -10082
- package/build/dependencies/astro-custom-elements-extensions/index.js.map +0 -1
- package/build/dependencies/astro-embedded-scripts-extensions/index.js +0 -8453
- package/build/dependencies/astro-embedded-scripts-extensions/index.js.map +0 -1
- package/build/dependencies/astro-html-embeds/index.d.ts +0 -5
- package/build/dependencies/astro-html-embeds/index.js +0 -25
- package/build/dependencies/astro-html-embeds/index.js.map +0 -1
- package/build/dependencies/astro-payment-links/index.d.ts +0 -5
- package/build/dependencies/astro-payment-links/index.js +0 -42
- package/build/dependencies/astro-payment-links/index.js.map +0 -1
- package/build/dependencies/astro-robots/index.d.ts +0 -5
- package/build/dependencies/astro-robots/index.js +0 -23
- package/build/dependencies/astro-robots/index.js.map +0 -1
- package/build/dependencies/astro-site-plugins-extensions/index.js +0 -49
- package/build/dependencies/astro-site-plugins-extensions/index.js.map +0 -1
- package/build/dependencies/astro-viewer-api/index.d.ts +0 -5
- package/build/dependencies/astro-viewer-api/index.js +0 -22
- package/build/dependencies/astro-viewer-api/index.js.map +0 -1
- package/build/index.d.ts +0 -16
- package/build/index.js +0 -56
- package/build/index.js.map +0 -1
- package/build/integration/chunk-OJIGUJIG.js.map +0 -1
|
@@ -11,6 +11,6 @@ interface WixAstroConfig {
|
|
|
11
11
|
enable?: boolean;
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
|
-
declare const createIntegration: (config?: WixAstroConfig) => AstroIntegration;
|
|
14
|
+
declare const createIntegration: (config?: WixAstroConfig) => AstroIntegration[];
|
|
15
15
|
|
|
16
16
|
export { createIntegration as default };
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
defaultOutdent,
|
|
13
13
|
init_esm_shims,
|
|
14
14
|
normalizePath
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-UBCQK5ZU.js";
|
|
16
16
|
|
|
17
17
|
// src/index.ts
|
|
18
18
|
init_esm_shims();
|
|
@@ -273,33 +273,21 @@ var createIntegration14 = (config) => {
|
|
|
273
273
|
const enableAuthRoutes = isEnabled(config?.auth);
|
|
274
274
|
const enableHtmlEmbeds = isEnabled(config?.htmlEmbeds);
|
|
275
275
|
const enableRobots = isEnabled(config?.robots);
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
createIntegration5(),
|
|
292
|
-
createIntegration7(),
|
|
293
|
-
createIntegration6(),
|
|
294
|
-
...enableRobots ? [src_default4()] : [],
|
|
295
|
-
createIntegration13()
|
|
296
|
-
]
|
|
297
|
-
})
|
|
298
|
-
]
|
|
299
|
-
});
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
};
|
|
276
|
+
const integrations = [
|
|
277
|
+
src_default({ enableAuthRoutes }),
|
|
278
|
+
createIntegration(),
|
|
279
|
+
createIntegration2(),
|
|
280
|
+
createIntegration8(),
|
|
281
|
+
createIntegration4(),
|
|
282
|
+
...enableHtmlEmbeds ? [src_default2()] : [],
|
|
283
|
+
src_default3(),
|
|
284
|
+
createIntegration5(),
|
|
285
|
+
createIntegration7(),
|
|
286
|
+
createIntegration6(),
|
|
287
|
+
...enableRobots ? [src_default4()] : [],
|
|
288
|
+
createIntegration13()
|
|
289
|
+
];
|
|
290
|
+
return [createIntegration3({ integrations }), ...integrations];
|
|
303
291
|
};
|
|
304
292
|
var index_default = createIntegration14;
|
|
305
293
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts","../../../astro-auth/src/index.ts","../../../astro-auth/src/plugins/patchAstroInlineScripts.ts","../../../astro-auth/src/plugins/setupContentCollectionContext.ts","../../../astro-html-embeds/src/index.ts","../../../astro-payment-links/src/index.ts","../../../astro-robots/src/index.ts","../../../astro-viewer-api/src/index.ts","../../../astro-viewer-api/src/integration.ts"],"sourcesContent":["import type { AstroIntegration } from 'astro';\nimport auth from '@wix/astro-auth';\nimport backend from '@wix/astro-backend-extensions';\nimport backoffice from '@wix/astro-backoffice-extensions';\nimport core from '@wix/astro-core';\nimport customElements from '@wix/astro-custom-elements-extensions';\nimport embeddedScripts from '@wix/astro-embedded-scripts-extensions';\nimport htmlEmbeds from '@wix/astro-html-embeds';\nimport paymentLinks from '@wix/astro-payment-links';\nimport robots from '@wix/astro-robots';\nimport siteComponentPanels from '@wix/astro-site-component-panels-extensions';\nimport siteComponents from '@wix/astro-site-components-extensions';\nimport sitePlugins from '@wix/astro-site-plugins-extensions';\nimport viewerApi from '@wix/astro-viewer-api';\n\ninterface WixAstroConfig {\n auth?: boolean | { enable?: boolean };\n htmlEmbeds?: boolean | { enable?: boolean };\n robots?: boolean | { enable?: boolean };\n}\n\nfunction isEnabled(value?: boolean | { enable?: boolean }): boolean {\n if (typeof value === 'boolean') {\n return value;\n }\n return value?.enable ?? true;\n}\n\nconst createIntegration = (config?: WixAstroConfig): AstroIntegration => {\n const enableAuthRoutes = isEnabled(config?.auth);\n const enableHtmlEmbeds = isEnabled(config?.htmlEmbeds);\n const enableRobots = isEnabled(config?.robots);\n\n return {\n name: '@wix/astro',\n hooks: {\n async 'astro:config:setup'({ updateConfig }) {\n updateConfig({\n integrations: [\n core({\n integrations: [\n auth({ enableAuthRoutes }),\n backend(),\n backoffice(),\n sitePlugins(),\n customElements(),\n ...(enableHtmlEmbeds ? [htmlEmbeds()] : []),\n paymentLinks(),\n embeddedScripts(),\n siteComponents(),\n siteComponentPanels(),\n ...(enableRobots ? [robots()] : []),\n viewerApi(),\n ],\n }),\n ],\n });\n },\n },\n };\n};\n\nexport default createIntegration;\n","import { fileURLToPath } from 'node:url';\nimport type { WixIntegration } from '@wix/astro-core';\nimport { normalizePath } from '@wix/vite-utils';\nimport { outdent } from 'outdent';\nimport { patchAstroInlineScripts } from './plugins/patchAstroInlineScripts.js';\nimport { setupContentCollectionContext } from './plugins/setupContentCollectionContext.js';\n\nconst setupContextUrl = new URL(\n '../dependencies/astro-auth/browser-runtime/setup.js',\n import.meta.url\n);\n\nconst createIntegration = ({\n enableAuthRoutes,\n}: {\n enableAuthRoutes: boolean;\n}): WixIntegration => {\n return {\n name: '@wix/astro/auth',\n hooks: {\n 'astro:config:setup'({\n addMiddleware,\n config,\n injectRoute,\n injectScript,\n updateConfig,\n }) {\n const srcDir = fileURLToPath(config.srcDir);\n\n updateConfig({\n vite: {\n plugins: [\n setupContentCollectionContext(srcDir),\n patchAstroInlineScripts(),\n ],\n },\n });\n\n const setupContextCode = outdent`\n import { WIX_CLIENT_ID } from 'astro:env/client';\n import { setup } from '${normalizePath(setupContextUrl)}';\n\n setup({ clientId: WIX_CLIENT_ID });\n `;\n\n // support client-side context calls\n injectScript('before-hydration', setupContextCode);\n injectScript('page', setupContextCode);\n\n // support server side context calls\n addMiddleware({\n entrypoint: new URL(\n '../dependencies/astro-auth/backend-runtime/middleware/auth.js',\n import.meta.url\n ),\n order: 'pre',\n });\n\n // support built-in auth routes\n if (enableAuthRoutes) {\n injectRoute({\n entrypoint: new URL(\n '../dependencies/astro-auth/backend-runtime/routes/login.js',\n import.meta.url\n ),\n pattern: '/api/auth/login',\n prerender: false,\n });\n\n injectRoute({\n entrypoint: new URL(\n '../dependencies/astro-auth/backend-runtime/routes/logout.js',\n import.meta.url\n ),\n pattern: '/api/auth/logout',\n prerender: false,\n });\n\n injectRoute({\n entrypoint: new URL(\n '../dependencies/astro-auth/backend-runtime/routes/callback.js',\n import.meta.url\n ),\n pattern: '/api/auth/callback',\n prerender: false,\n });\n\n injectRoute({\n entrypoint: new URL(\n '../dependencies/astro-auth/backend-runtime/routes/logout-callback.js',\n import.meta.url\n ),\n pattern: '/api/auth/logout-callback',\n prerender: false,\n });\n }\n },\n },\n };\n};\n\nexport default createIntegration;\n","import type { PluginOption } from 'vite';\nimport { outdent } from 'outdent';\n\nexport function patchAstroInlineScripts(): PluginOption {\n return {\n name: 'patch-astro-inline-scripts',\n transform(code, id) {\n const [_filename, rawQuery] = id.split(`?`, 2);\n const query = Object.fromEntries(new URLSearchParams(rawQuery).entries());\n\n if (\n query.astro == null ||\n query.type !== 'script' ||\n query['lang.ts'] == null ||\n code === ''\n ) {\n return null;\n }\n\n return outdent`\n import 'astro:scripts/page.js';\n\n ${code}\n `;\n },\n };\n}\n","import { relative } from 'node:path';\nimport type { PluginOption } from 'vite';\nimport { normalizePath } from '@wix/vite-utils';\nimport { outdent } from 'outdent';\n\n// https://github.com/withastro/astro/blob/e0c4460c5b6cc0c19b705d81820809aef0544100/packages/astro/src/content/utils.ts#L748-L763\nconst contentCollectionFilePaths = [\n 'content.config.mjs',\n 'content.config.js',\n 'content.config.mts',\n 'content.config.ts',\n 'content/config.mjs',\n 'content/config.js',\n 'content/config.mts',\n 'content/config.ts',\n];\n\nconst setupContextualClientUrl = new URL(\n '../dependencies/astro-auth/backend-runtime/runtime/backend/setupContextualClient.js',\n import.meta.url\n);\n\nexport function setupContentCollectionContext(srcDir: string): PluginOption {\n return {\n name: 'setup-content-collection-context',\n applyToEnvironment(environment) {\n return environment.name === 'ssr';\n },\n transform(code, id) {\n const relativeId = relative(srcDir, id);\n\n const isContentCollectionFile =\n contentCollectionFilePaths.includes(relativeId);\n\n if (isContentCollectionFile) {\n return outdent`\n import '${normalizePath(setupContextualClientUrl)}';\n\n ${code}\n `;\n }\n\n return null;\n },\n };\n}\n","import type { WixIntegration } from '@wix/astro-core';\n\nconst createIntegration = (): WixIntegration => {\n return {\n name: '@wix/astro/html-embeds',\n hooks: {\n 'astro:config:setup'({ addMiddleware }) {\n addMiddleware({\n entrypoint: new URL(\n '../dependencies/astro-html-embeds/backend-runtime/html-embeds.js',\n import.meta.url\n ),\n order: 'post',\n });\n },\n },\n };\n};\n\nexport default createIntegration;\n","import type { WixIntegration } from '@wix/astro-core';\n\nconst createIntegration = (): WixIntegration => {\n return {\n name: '@wix/astro/payment-links',\n hooks: {\n 'astro:config:setup'({ injectRoute }) {\n /*\n 1. A user generates a paylink -> https://mysite.com/_paylink/[id]\n 2. When accessing the paylink, our route redirects them to the Wix Payments link\n 3. Wix Payments then redirects the user to Wix Checkout,\n which may resolve to either https://mysite.com/checkout/... or https://mysite.com/__ecom/checkout/...,\n depending on the flow within Wix.\n */\n\n injectRoute({\n entrypoint: new URL(\n '../dependencies/astro-payment-links/backend-runtime/payment-link.js',\n import.meta.url\n ),\n pattern: '/_paylink/[id]',\n prerender: false,\n });\n\n injectRoute({\n entrypoint: new URL(\n '../dependencies/astro-payment-links/backend-runtime/payment-checkout.js',\n import.meta.url\n ),\n pattern: '/checkout',\n prerender: false,\n });\n\n injectRoute({\n entrypoint: new URL(\n '../dependencies/astro-payment-links/backend-runtime/payment-checkout.js',\n import.meta.url\n ),\n pattern: '/__ecom/checkout',\n prerender: false,\n });\n },\n },\n };\n};\n\nexport default createIntegration;\n","import type { WixIntegration } from '@wix/astro-core';\n\nconst createIntegration = (): WixIntegration => {\n return {\n name: '@wix/astro/robots',\n hooks: {\n 'astro:config:setup'({ injectRoute }) {\n injectRoute({\n entrypoint: new URL(\n '../dependencies/astro-robots/backend-runtime/robots.js',\n import.meta.url\n ),\n pattern: '/robots.txt',\n prerender: false,\n });\n },\n },\n };\n};\n\nexport default createIntegration;\n","export { createIntegration as default } from './integration.js';\n","import type { WixIntegration } from '@wix/astro-core';\n\nexport const createIntegration = (): WixIntegration => {\n return {\n name: '@wix/astro/viewer-api',\n hooks: {\n 'astro:config:setup'({ injectRoute }) {\n injectRoute({\n entrypoint: new URL(\n '../dependencies/astro-viewer-api/backend-runtime/api.js',\n import.meta.url\n ),\n pattern: '/_api/[...path]',\n prerender: false,\n });\n },\n },\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;;;ACAA;AAAA,SAAS,qBAAqB;;;ACA9B;AAGO,SAAS,0BAAwC;AACtD,SAAO;AAAA,IACL,MAAM;AAAA,IACN,UAAU,MAAM,IAAI;AAClB,YAAM,CAAC,WAAW,QAAQ,IAAI,GAAG,MAAM,KAAK,CAAC;AAC7C,YAAM,QAAQ,OAAO,YAAY,IAAI,gBAAgB,QAAQ,EAAE,QAAQ,CAAC;AAExE,UACE,MAAM,SAAS,QACf,MAAM,SAAS,YACf,MAAM,SAAS,KAAK,QACpB,SAAS,IACT;AACA,eAAO;AAAA,MACT;AAEA,aAAO;AAAA;AAAA;AAAA,UAGH,IAAI;AAAA;AAAA,IAEV;AAAA,EACF;AACF;;;AC1BA;AAAA,SAAS,gBAAgB;AAMzB,IAAM,6BAA6B;AAAA,EACjC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,IAAM,2BAA2B,IAAI;AAAA,EACnC;AAAA,EACA,YAAY;AACd;AAEO,SAAS,8BAA8B,QAA8B;AAC1E,SAAO;AAAA,IACL,MAAM;AAAA,IACN,mBAAmB,aAAa;AAC9B,aAAO,YAAY,SAAS;AAAA,IAC9B;AAAA,IACA,UAAU,MAAM,IAAI;AAClB,YAAM,aAAa,SAAS,QAAQ,EAAE;AAEtC,YAAM,0BACJ,2BAA2B,SAAS,UAAU;AAEhD,UAAI,yBAAyB;AAC3B,eAAO;AAAA,oB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","src_default","createIntegration","src_default","createIntegration","src_default","createIntegration","createIntegration","src_default"]}
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts","../../../astro-auth/src/index.ts","../../../astro-auth/src/plugins/patchAstroInlineScripts.ts","../../../astro-auth/src/plugins/setupContentCollectionContext.ts","../../../astro-html-embeds/src/index.ts","../../../astro-payment-links/src/index.ts","../../../astro-robots/src/index.ts","../../../astro-viewer-api/src/index.ts","../../../astro-viewer-api/src/integration.ts"],"sourcesContent":["import type { AstroIntegration } from 'astro';\nimport auth from '@wix/astro-auth';\nimport backend from '@wix/astro-backend-extensions';\nimport backoffice from '@wix/astro-backoffice-extensions';\nimport core from '@wix/astro-core';\nimport customElements from '@wix/astro-custom-elements-extensions';\nimport embeddedScripts from '@wix/astro-embedded-scripts-extensions';\nimport htmlEmbeds from '@wix/astro-html-embeds';\nimport paymentLinks from '@wix/astro-payment-links';\nimport robots from '@wix/astro-robots';\nimport siteComponentPanels from '@wix/astro-site-component-panels-extensions';\nimport siteComponents from '@wix/astro-site-components-extensions';\nimport sitePlugins from '@wix/astro-site-plugins-extensions';\nimport viewerApi from '@wix/astro-viewer-api';\n\ninterface WixAstroConfig {\n auth?: boolean | { enable?: boolean };\n htmlEmbeds?: boolean | { enable?: boolean };\n robots?: boolean | { enable?: boolean };\n}\n\nfunction isEnabled(value?: boolean | { enable?: boolean }): boolean {\n if (typeof value === 'boolean') {\n return value;\n }\n return value?.enable ?? true;\n}\n\nconst createIntegration = (config?: WixAstroConfig): AstroIntegration[] => {\n const enableAuthRoutes = isEnabled(config?.auth);\n const enableHtmlEmbeds = isEnabled(config?.htmlEmbeds);\n const enableRobots = isEnabled(config?.robots);\n\n const integrations = [\n auth({ enableAuthRoutes }),\n backend(),\n backoffice(),\n sitePlugins(),\n customElements(),\n ...(enableHtmlEmbeds ? [htmlEmbeds()] : []),\n paymentLinks(),\n embeddedScripts(),\n siteComponents(),\n siteComponentPanels(),\n ...(enableRobots ? [robots()] : []),\n viewerApi(),\n ];\n\n return [core({ integrations }), ...integrations];\n};\n\nexport default createIntegration;\n","import { fileURLToPath } from 'node:url';\nimport type { WixIntegration } from '@wix/astro-core';\nimport { normalizePath } from '@wix/vite-utils';\nimport { outdent } from 'outdent';\nimport { patchAstroInlineScripts } from './plugins/patchAstroInlineScripts.js';\nimport { setupContentCollectionContext } from './plugins/setupContentCollectionContext.js';\n\nconst setupContextUrl = new URL(\n '../dependencies/astro-auth/browser-runtime/setup.js',\n import.meta.url\n);\n\nconst createIntegration = ({\n enableAuthRoutes,\n}: {\n enableAuthRoutes: boolean;\n}): WixIntegration => {\n return {\n name: '@wix/astro/auth',\n hooks: {\n 'astro:config:setup'({\n addMiddleware,\n config,\n injectRoute,\n injectScript,\n updateConfig,\n }) {\n const srcDir = fileURLToPath(config.srcDir);\n\n updateConfig({\n vite: {\n plugins: [\n setupContentCollectionContext(srcDir),\n patchAstroInlineScripts(),\n ],\n },\n });\n\n const setupContextCode = outdent`\n import { WIX_CLIENT_ID } from 'astro:env/client';\n import { setup } from '${normalizePath(setupContextUrl)}';\n\n setup({ clientId: WIX_CLIENT_ID });\n `;\n\n // support client-side context calls\n injectScript('before-hydration', setupContextCode);\n injectScript('page', setupContextCode);\n\n // support server side context calls\n addMiddleware({\n entrypoint: new URL(\n '../dependencies/astro-auth/backend-runtime/middleware/auth.js',\n import.meta.url\n ),\n order: 'pre',\n });\n\n // support built-in auth routes\n if (enableAuthRoutes) {\n injectRoute({\n entrypoint: new URL(\n '../dependencies/astro-auth/backend-runtime/routes/login.js',\n import.meta.url\n ),\n pattern: '/api/auth/login',\n prerender: false,\n });\n\n injectRoute({\n entrypoint: new URL(\n '../dependencies/astro-auth/backend-runtime/routes/logout.js',\n import.meta.url\n ),\n pattern: '/api/auth/logout',\n prerender: false,\n });\n\n injectRoute({\n entrypoint: new URL(\n '../dependencies/astro-auth/backend-runtime/routes/callback.js',\n import.meta.url\n ),\n pattern: '/api/auth/callback',\n prerender: false,\n });\n\n injectRoute({\n entrypoint: new URL(\n '../dependencies/astro-auth/backend-runtime/routes/logout-callback.js',\n import.meta.url\n ),\n pattern: '/api/auth/logout-callback',\n prerender: false,\n });\n }\n },\n },\n };\n};\n\nexport default createIntegration;\n","import type { PluginOption } from 'vite';\nimport { outdent } from 'outdent';\n\nexport function patchAstroInlineScripts(): PluginOption {\n return {\n name: 'patch-astro-inline-scripts',\n transform(code, id) {\n const [_filename, rawQuery] = id.split(`?`, 2);\n const query = Object.fromEntries(new URLSearchParams(rawQuery).entries());\n\n if (\n query.astro == null ||\n query.type !== 'script' ||\n query['lang.ts'] == null ||\n code === ''\n ) {\n return null;\n }\n\n return outdent`\n import 'astro:scripts/page.js';\n\n ${code}\n `;\n },\n };\n}\n","import { relative } from 'node:path';\nimport type { PluginOption } from 'vite';\nimport { normalizePath } from '@wix/vite-utils';\nimport { outdent } from 'outdent';\n\n// https://github.com/withastro/astro/blob/e0c4460c5b6cc0c19b705d81820809aef0544100/packages/astro/src/content/utils.ts#L748-L763\nconst contentCollectionFilePaths = [\n 'content.config.mjs',\n 'content.config.js',\n 'content.config.mts',\n 'content.config.ts',\n 'content/config.mjs',\n 'content/config.js',\n 'content/config.mts',\n 'content/config.ts',\n];\n\nconst setupContextualClientUrl = new URL(\n '../dependencies/astro-auth/backend-runtime/runtime/backend/setupContextualClient.js',\n import.meta.url\n);\n\nexport function setupContentCollectionContext(srcDir: string): PluginOption {\n return {\n name: 'setup-content-collection-context',\n applyToEnvironment(environment) {\n return environment.name === 'ssr';\n },\n transform(code, id) {\n const relativeId = relative(srcDir, id);\n\n const isContentCollectionFile =\n contentCollectionFilePaths.includes(relativeId);\n\n if (isContentCollectionFile) {\n return outdent`\n import '${normalizePath(setupContextualClientUrl)}';\n\n ${code}\n `;\n }\n\n return null;\n },\n };\n}\n","import type { WixIntegration } from '@wix/astro-core';\n\nconst createIntegration = (): WixIntegration => {\n return {\n name: '@wix/astro/html-embeds',\n hooks: {\n 'astro:config:setup'({ addMiddleware }) {\n addMiddleware({\n entrypoint: new URL(\n '../dependencies/astro-html-embeds/backend-runtime/html-embeds.js',\n import.meta.url\n ),\n order: 'post',\n });\n },\n },\n };\n};\n\nexport default createIntegration;\n","import type { WixIntegration } from '@wix/astro-core';\n\nconst createIntegration = (): WixIntegration => {\n return {\n name: '@wix/astro/payment-links',\n hooks: {\n 'astro:config:setup'({ injectRoute }) {\n /*\n 1. A user generates a paylink -> https://mysite.com/_paylink/[id]\n 2. When accessing the paylink, our route redirects them to the Wix Payments link\n 3. Wix Payments then redirects the user to Wix Checkout,\n which may resolve to either https://mysite.com/checkout/... or https://mysite.com/__ecom/checkout/...,\n depending on the flow within Wix.\n */\n\n injectRoute({\n entrypoint: new URL(\n '../dependencies/astro-payment-links/backend-runtime/payment-link.js',\n import.meta.url\n ),\n pattern: '/_paylink/[id]',\n prerender: false,\n });\n\n injectRoute({\n entrypoint: new URL(\n '../dependencies/astro-payment-links/backend-runtime/payment-checkout.js',\n import.meta.url\n ),\n pattern: '/checkout',\n prerender: false,\n });\n\n injectRoute({\n entrypoint: new URL(\n '../dependencies/astro-payment-links/backend-runtime/payment-checkout.js',\n import.meta.url\n ),\n pattern: '/__ecom/checkout',\n prerender: false,\n });\n },\n },\n };\n};\n\nexport default createIntegration;\n","import type { WixIntegration } from '@wix/astro-core';\n\nconst createIntegration = (): WixIntegration => {\n return {\n name: '@wix/astro/robots',\n hooks: {\n 'astro:config:setup'({ injectRoute }) {\n injectRoute({\n entrypoint: new URL(\n '../dependencies/astro-robots/backend-runtime/robots.js',\n import.meta.url\n ),\n pattern: '/robots.txt',\n prerender: false,\n });\n },\n },\n };\n};\n\nexport default createIntegration;\n","export { createIntegration as default } from './integration.js';\n","import type { WixIntegration } from '@wix/astro-core';\n\nexport const createIntegration = (): WixIntegration => {\n return {\n name: '@wix/astro/viewer-api',\n hooks: {\n 'astro:config:setup'({ injectRoute }) {\n injectRoute({\n entrypoint: new URL(\n '../dependencies/astro-viewer-api/backend-runtime/api.js',\n import.meta.url\n ),\n pattern: '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A,UACA,SAAS;AAAA,UACT,WAAW;AAAA,QACb,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AACF;;;ARGA,SAAS,UAAU,OAAiD;AAClE,MAAI,OAAO,UAAU,WAAW;AAC9B,WAAO;AAAA,EACT;AACA,SAAO,OAAO,UAAU;AAC1B;AAEA,IAAMC,sBAAoB,CAAC,WAAgD;AACzE,QAAM,mBAAmB,UAAU,QAAQ,IAAI;AAC/C,QAAM,mBAAmB,UAAU,QAAQ,UAAU;AACrD,QAAM,eAAe,UAAU,QAAQ,MAAM;AAE7C,QAAM,eAAe;AAAA,IACnB,YAAK,EAAE,iBAAiB,CAAC;AAAA,IACzB,kBAAQ;AAAA,IACRA,mBAAW;AAAA,IACXA,mBAAY;AAAA,IACZA,mBAAe;AAAA,IACf,GAAI,mBAAmB,CAACC,aAAW,CAAC,IAAI,CAAC;AAAA,IACzCA,aAAa;AAAA,IACbD,mBAAgB;AAAA,IAChBA,mBAAe;AAAA,IACfA,mBAAoB;AAAA,IACpB,GAAI,eAAe,CAACC,aAAO,CAAC,IAAI,CAAC;AAAA,IACjCD,oBAAU;AAAA,EACZ;AAEA,SAAO,CAACA,mBAAK,EAAE,aAAa,CAAC,GAAG,GAAG,YAAY;AACjD;AAEA,IAAO,gBAAQA;","names":["createIntegration","createIntegration","src_default","createIntegration","src_default","createIntegration","src_default","createIntegration","createIntegration","src_default"]}
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/astro",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.12.0",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@wix/auth-management": "^1.0.71",
|
|
6
6
|
"@wix/dashboard": "^1.3.40",
|
|
7
|
+
"@wix/editor": "^1.403.0",
|
|
7
8
|
"@wix/headless-node": "^1.11.0",
|
|
8
9
|
"@wix/headless-site": "^1.10.0",
|
|
9
10
|
"@wix/headless-site-assets": "^1.0.2",
|
|
@@ -37,11 +38,13 @@
|
|
|
37
38
|
"./package.json": "./package.json"
|
|
38
39
|
},
|
|
39
40
|
"files": [
|
|
40
|
-
"build"
|
|
41
|
+
"build",
|
|
42
|
+
"CHANGELOG.md"
|
|
41
43
|
],
|
|
42
44
|
"peerDependencies": {
|
|
43
45
|
"astro": "^5.0.0",
|
|
44
|
-
"react": "^18.3.1"
|
|
46
|
+
"react": "^18.3.1",
|
|
47
|
+
"react-dom": "^18.3.1"
|
|
45
48
|
},
|
|
46
49
|
"publishConfig": {
|
|
47
50
|
"registry": "https://registry.npmjs.org/",
|
package/build/builders.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export { ecomAdditionalFees, ecomDiscountsTrigger, ecomGiftCardsProvider, ecomPaymentSettings, ecomShippingRates, ecomValidations, webhook } from '@wix/astro-backend-extensions';
|
|
2
|
-
export { backofficeExtensionMenuPlugin, backofficeExtensionWidget, backofficeModal, backofficePage } from '@wix/astro-backoffice-extensions';
|
|
3
|
-
export { app, genericExtension } from '@wix/astro-core';
|
|
4
|
-
export { customElement } from '@wix/astro-custom-elements-extensions';
|
|
5
|
-
export { embeddedScript } from '@wix/astro-embedded-scripts-extensions';
|
|
6
|
-
export { sitePlugin } from '@wix/astro-site-plugins-extensions';
|
package/build/builders.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { createRequire as _createRequire } from 'node:module';
|
|
2
|
-
const require = _createRequire(import.meta.url);
|
|
3
|
-
|
|
4
|
-
// src/builders.ts
|
|
5
|
-
import {
|
|
6
|
-
ecomAdditionalFees,
|
|
7
|
-
ecomDiscountsTrigger,
|
|
8
|
-
ecomGiftCardsProvider,
|
|
9
|
-
ecomPaymentSettings,
|
|
10
|
-
ecomShippingRates,
|
|
11
|
-
ecomValidations,
|
|
12
|
-
webhook
|
|
13
|
-
} from "@wix/astro-backend-extensions";
|
|
14
|
-
import {
|
|
15
|
-
backofficeExtensionMenuPlugin,
|
|
16
|
-
backofficeExtensionWidget,
|
|
17
|
-
backofficeModal,
|
|
18
|
-
backofficePage
|
|
19
|
-
} from "@wix/astro-backoffice-extensions";
|
|
20
|
-
import { app, genericExtension } from "@wix/astro-core";
|
|
21
|
-
import { customElement } from "@wix/astro-custom-elements-extensions";
|
|
22
|
-
import { embeddedScript } from "@wix/astro-embedded-scripts-extensions";
|
|
23
|
-
import { sitePlugin } from "@wix/astro-site-plugins-extensions";
|
|
24
|
-
export {
|
|
25
|
-
app,
|
|
26
|
-
backofficeExtensionMenuPlugin,
|
|
27
|
-
backofficeExtensionWidget,
|
|
28
|
-
backofficeModal,
|
|
29
|
-
backofficePage,
|
|
30
|
-
customElement,
|
|
31
|
-
ecomAdditionalFees,
|
|
32
|
-
ecomDiscountsTrigger,
|
|
33
|
-
ecomGiftCardsProvider,
|
|
34
|
-
ecomPaymentSettings,
|
|
35
|
-
ecomShippingRates,
|
|
36
|
-
ecomValidations,
|
|
37
|
-
embeddedScript,
|
|
38
|
-
genericExtension,
|
|
39
|
-
sitePlugin,
|
|
40
|
-
webhook
|
|
41
|
-
};
|
|
42
|
-
//# sourceMappingURL=builders.js.map
|
package/build/builders.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/builders.ts"],"sourcesContent":["export {\n ecomAdditionalFees,\n ecomDiscountsTrigger,\n ecomGiftCardsProvider,\n ecomPaymentSettings,\n ecomShippingRates,\n ecomValidations,\n webhook,\n} from '@wix/astro-backend-extensions';\nexport {\n backofficeExtensionMenuPlugin,\n backofficeExtensionWidget,\n backofficeModal,\n backofficePage,\n} from '@wix/astro-backoffice-extensions';\nexport { app, genericExtension } from '@wix/astro-core';\nexport { customElement } from '@wix/astro-custom-elements-extensions';\nexport { embeddedScript } from '@wix/astro-embedded-scripts-extensions';\nexport { sitePlugin } from '@wix/astro-site-plugins-extensions';\n"],"mappings":";;;;AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,KAAK,wBAAwB;AACtC,SAAS,qBAAqB;AAC9B,SAAS,sBAAsB;AAC/B,SAAS,kBAAkB;","names":[]}
|
|
@@ -1,301 +0,0 @@
|
|
|
1
|
-
import { createRequire as _createRequire } from 'node:module';
|
|
2
|
-
const require = _createRequire(import.meta.url);
|
|
3
|
-
|
|
4
|
-
// src/index.ts
|
|
5
|
-
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
6
|
-
|
|
7
|
-
// ../fs-utils/src/index.ts
|
|
8
|
-
import {
|
|
9
|
-
access,
|
|
10
|
-
readFile as fsReadFile,
|
|
11
|
-
mkdir,
|
|
12
|
-
rm,
|
|
13
|
-
writeFile
|
|
14
|
-
} from "fs/promises";
|
|
15
|
-
import { EOL } from "os";
|
|
16
|
-
import { dirname } from "path";
|
|
17
|
-
import process from "process";
|
|
18
|
-
import { fileURLToPath } from "url";
|
|
19
|
-
var isWindows = process.platform === "win32";
|
|
20
|
-
function normalizePath(id) {
|
|
21
|
-
const filePath = typeof id === "string" ? id : fileURLToPath(id);
|
|
22
|
-
return isWindows ? slash(filePath) : filePath;
|
|
23
|
-
}
|
|
24
|
-
function slash(path) {
|
|
25
|
-
return path.replaceAll("\\", "/");
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// ../../node_modules/outdent/lib-module/index.js
|
|
29
|
-
function noop() {
|
|
30
|
-
var args = [];
|
|
31
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
32
|
-
args[_i] = arguments[_i];
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
function createWeakMap() {
|
|
36
|
-
if (typeof WeakMap !== "undefined") {
|
|
37
|
-
return /* @__PURE__ */ new WeakMap();
|
|
38
|
-
} else {
|
|
39
|
-
return fakeSetOrMap();
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
function fakeSetOrMap() {
|
|
43
|
-
return {
|
|
44
|
-
add: noop,
|
|
45
|
-
delete: noop,
|
|
46
|
-
get: noop,
|
|
47
|
-
set: noop,
|
|
48
|
-
has: function(k) {
|
|
49
|
-
return false;
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
var hop = Object.prototype.hasOwnProperty;
|
|
54
|
-
var has = function(obj, prop) {
|
|
55
|
-
return hop.call(obj, prop);
|
|
56
|
-
};
|
|
57
|
-
function extend(target, source) {
|
|
58
|
-
for (var prop in source) {
|
|
59
|
-
if (has(source, prop)) {
|
|
60
|
-
target[prop] = source[prop];
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
return target;
|
|
64
|
-
}
|
|
65
|
-
var reLeadingNewline = /^[ \t]*(?:\r\n|\r|\n)/;
|
|
66
|
-
var reTrailingNewline = /(?:\r\n|\r|\n)[ \t]*$/;
|
|
67
|
-
var reStartsWithNewlineOrIsEmpty = /^(?:[\r\n]|$)/;
|
|
68
|
-
var reDetectIndentation = /(?:\r\n|\r|\n)([ \t]*)(?:[^ \t\r\n]|$)/;
|
|
69
|
-
var reOnlyWhitespaceWithAtLeastOneNewline = /^[ \t]*[\r\n][ \t\r\n]*$/;
|
|
70
|
-
function _outdentArray(strings, firstInterpolatedValueSetsIndentationLevel, options) {
|
|
71
|
-
var indentationLevel = 0;
|
|
72
|
-
var match = strings[0].match(reDetectIndentation);
|
|
73
|
-
if (match) {
|
|
74
|
-
indentationLevel = match[1].length;
|
|
75
|
-
}
|
|
76
|
-
var reSource = "(\\r\\n|\\r|\\n).{0," + indentationLevel + "}";
|
|
77
|
-
var reMatchIndent = new RegExp(reSource, "g");
|
|
78
|
-
if (firstInterpolatedValueSetsIndentationLevel) {
|
|
79
|
-
strings = strings.slice(1);
|
|
80
|
-
}
|
|
81
|
-
var newline = options.newline, trimLeadingNewline = options.trimLeadingNewline, trimTrailingNewline = options.trimTrailingNewline;
|
|
82
|
-
var normalizeNewlines = typeof newline === "string";
|
|
83
|
-
var l = strings.length;
|
|
84
|
-
var outdentedStrings = strings.map(function(v, i) {
|
|
85
|
-
v = v.replace(reMatchIndent, "$1");
|
|
86
|
-
if (i === 0 && trimLeadingNewline) {
|
|
87
|
-
v = v.replace(reLeadingNewline, "");
|
|
88
|
-
}
|
|
89
|
-
if (i === l - 1 && trimTrailingNewline) {
|
|
90
|
-
v = v.replace(reTrailingNewline, "");
|
|
91
|
-
}
|
|
92
|
-
if (normalizeNewlines) {
|
|
93
|
-
v = v.replace(/\r\n|\n|\r/g, function(_) {
|
|
94
|
-
return newline;
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
return v;
|
|
98
|
-
});
|
|
99
|
-
return outdentedStrings;
|
|
100
|
-
}
|
|
101
|
-
function concatStringsAndValues(strings, values) {
|
|
102
|
-
var ret = "";
|
|
103
|
-
for (var i = 0, l = strings.length; i < l; i++) {
|
|
104
|
-
ret += strings[i];
|
|
105
|
-
if (i < l - 1) {
|
|
106
|
-
ret += values[i];
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
return ret;
|
|
110
|
-
}
|
|
111
|
-
function isTemplateStringsArray(v) {
|
|
112
|
-
return has(v, "raw") && has(v, "length");
|
|
113
|
-
}
|
|
114
|
-
function createInstance(options) {
|
|
115
|
-
var arrayAutoIndentCache = createWeakMap();
|
|
116
|
-
var arrayFirstInterpSetsIndentCache = createWeakMap();
|
|
117
|
-
function outdent(stringsOrOptions) {
|
|
118
|
-
var values = [];
|
|
119
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
|
120
|
-
values[_i - 1] = arguments[_i];
|
|
121
|
-
}
|
|
122
|
-
if (isTemplateStringsArray(stringsOrOptions)) {
|
|
123
|
-
var strings = stringsOrOptions;
|
|
124
|
-
var firstInterpolatedValueSetsIndentationLevel = (values[0] === outdent || values[0] === defaultOutdent) && reOnlyWhitespaceWithAtLeastOneNewline.test(strings[0]) && reStartsWithNewlineOrIsEmpty.test(strings[1]);
|
|
125
|
-
var cache = firstInterpolatedValueSetsIndentationLevel ? arrayFirstInterpSetsIndentCache : arrayAutoIndentCache;
|
|
126
|
-
var renderedArray = cache.get(strings);
|
|
127
|
-
if (!renderedArray) {
|
|
128
|
-
renderedArray = _outdentArray(strings, firstInterpolatedValueSetsIndentationLevel, options);
|
|
129
|
-
cache.set(strings, renderedArray);
|
|
130
|
-
}
|
|
131
|
-
if (values.length === 0) {
|
|
132
|
-
return renderedArray[0];
|
|
133
|
-
}
|
|
134
|
-
var rendered = concatStringsAndValues(renderedArray, firstInterpolatedValueSetsIndentationLevel ? values.slice(1) : values);
|
|
135
|
-
return rendered;
|
|
136
|
-
} else {
|
|
137
|
-
return createInstance(extend(extend({}, options), stringsOrOptions || {}));
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
var fullOutdent = extend(outdent, {
|
|
141
|
-
string: function(str) {
|
|
142
|
-
return _outdentArray([str], false, options)[0];
|
|
143
|
-
}
|
|
144
|
-
});
|
|
145
|
-
return fullOutdent;
|
|
146
|
-
}
|
|
147
|
-
var defaultOutdent = createInstance({
|
|
148
|
-
trimLeadingNewline: true,
|
|
149
|
-
trimTrailingNewline: true
|
|
150
|
-
});
|
|
151
|
-
if (typeof module !== "undefined") {
|
|
152
|
-
try {
|
|
153
|
-
module.exports = defaultOutdent;
|
|
154
|
-
Object.defineProperty(defaultOutdent, "__esModule", { value: true });
|
|
155
|
-
defaultOutdent.default = defaultOutdent;
|
|
156
|
-
defaultOutdent.outdent = defaultOutdent;
|
|
157
|
-
} catch (e) {
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
// src/plugins/patchAstroInlineScripts.ts
|
|
162
|
-
function patchAstroInlineScripts() {
|
|
163
|
-
return {
|
|
164
|
-
name: "patch-astro-inline-scripts",
|
|
165
|
-
transform(code, id) {
|
|
166
|
-
const [_filename, rawQuery] = id.split(`?`, 2);
|
|
167
|
-
const query = Object.fromEntries(new URLSearchParams(rawQuery).entries());
|
|
168
|
-
if (query.astro == null || query.type !== "script" || query["lang.ts"] == null || code === "") {
|
|
169
|
-
return null;
|
|
170
|
-
}
|
|
171
|
-
return defaultOutdent`
|
|
172
|
-
import 'astro:scripts/page.js';
|
|
173
|
-
|
|
174
|
-
${code}
|
|
175
|
-
`;
|
|
176
|
-
}
|
|
177
|
-
};
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
// src/plugins/setupContentCollectionContext.ts
|
|
181
|
-
import { relative } from "path";
|
|
182
|
-
var contentCollectionFilePaths = [
|
|
183
|
-
"content.config.mjs",
|
|
184
|
-
"content.config.js",
|
|
185
|
-
"content.config.mts",
|
|
186
|
-
"content.config.ts",
|
|
187
|
-
"content/config.mjs",
|
|
188
|
-
"content/config.js",
|
|
189
|
-
"content/config.mts",
|
|
190
|
-
"content/config.ts"
|
|
191
|
-
];
|
|
192
|
-
var setupContextualClientUrl = new URL(
|
|
193
|
-
"../build-runtime/runtime/backend/setupContextualClient.js",
|
|
194
|
-
import.meta.url
|
|
195
|
-
);
|
|
196
|
-
function setupContentCollectionContext(srcDir) {
|
|
197
|
-
return {
|
|
198
|
-
name: "setup-content-collection-context",
|
|
199
|
-
applyToEnvironment(environment) {
|
|
200
|
-
return environment.name === "ssr";
|
|
201
|
-
},
|
|
202
|
-
transform(code, id) {
|
|
203
|
-
const relativeId = relative(srcDir, id);
|
|
204
|
-
const isContentCollectionFile = contentCollectionFilePaths.includes(relativeId);
|
|
205
|
-
if (isContentCollectionFile) {
|
|
206
|
-
return defaultOutdent`
|
|
207
|
-
import '${normalizePath(setupContextualClientUrl)}';
|
|
208
|
-
|
|
209
|
-
${code}
|
|
210
|
-
`;
|
|
211
|
-
}
|
|
212
|
-
return null;
|
|
213
|
-
}
|
|
214
|
-
};
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
// src/index.ts
|
|
218
|
-
var setupContextUrl = new URL(
|
|
219
|
-
"../build-browser-runtime/setup.js",
|
|
220
|
-
import.meta.url
|
|
221
|
-
);
|
|
222
|
-
var createIntegration = ({
|
|
223
|
-
enableAuthRoutes
|
|
224
|
-
}) => {
|
|
225
|
-
return {
|
|
226
|
-
name: "@wix/astro/auth",
|
|
227
|
-
hooks: {
|
|
228
|
-
"astro:config:setup"({
|
|
229
|
-
addMiddleware,
|
|
230
|
-
config,
|
|
231
|
-
injectRoute,
|
|
232
|
-
injectScript,
|
|
233
|
-
updateConfig
|
|
234
|
-
}) {
|
|
235
|
-
const srcDir = fileURLToPath2(config.srcDir);
|
|
236
|
-
updateConfig({
|
|
237
|
-
vite: {
|
|
238
|
-
plugins: [
|
|
239
|
-
setupContentCollectionContext(srcDir),
|
|
240
|
-
patchAstroInlineScripts()
|
|
241
|
-
]
|
|
242
|
-
}
|
|
243
|
-
});
|
|
244
|
-
const setupContextCode = defaultOutdent`
|
|
245
|
-
import { WIX_CLIENT_ID } from 'astro:env/client';
|
|
246
|
-
import { setup } from '${normalizePath(setupContextUrl)}';
|
|
247
|
-
|
|
248
|
-
setup({ clientId: WIX_CLIENT_ID });
|
|
249
|
-
`;
|
|
250
|
-
injectScript("before-hydration", setupContextCode);
|
|
251
|
-
injectScript("page", setupContextCode);
|
|
252
|
-
addMiddleware({
|
|
253
|
-
entrypoint: new URL(
|
|
254
|
-
"../build-runtime/middleware/auth.js",
|
|
255
|
-
import.meta.url
|
|
256
|
-
),
|
|
257
|
-
order: "pre"
|
|
258
|
-
});
|
|
259
|
-
if (enableAuthRoutes) {
|
|
260
|
-
injectRoute({
|
|
261
|
-
entrypoint: new URL(
|
|
262
|
-
"../build-runtime/routes/login.js",
|
|
263
|
-
import.meta.url
|
|
264
|
-
),
|
|
265
|
-
pattern: "/api/auth/login",
|
|
266
|
-
prerender: false
|
|
267
|
-
});
|
|
268
|
-
injectRoute({
|
|
269
|
-
entrypoint: new URL(
|
|
270
|
-
"../build-runtime/routes/logout.js",
|
|
271
|
-
import.meta.url
|
|
272
|
-
),
|
|
273
|
-
pattern: "/api/auth/logout",
|
|
274
|
-
prerender: false
|
|
275
|
-
});
|
|
276
|
-
injectRoute({
|
|
277
|
-
entrypoint: new URL(
|
|
278
|
-
"../build-runtime/routes/callback.js",
|
|
279
|
-
import.meta.url
|
|
280
|
-
),
|
|
281
|
-
pattern: "/api/auth/callback",
|
|
282
|
-
prerender: false
|
|
283
|
-
});
|
|
284
|
-
injectRoute({
|
|
285
|
-
entrypoint: new URL(
|
|
286
|
-
"../build-runtime/routes/logout-callback.js",
|
|
287
|
-
import.meta.url
|
|
288
|
-
),
|
|
289
|
-
pattern: "/api/auth/logout-callback",
|
|
290
|
-
prerender: false
|
|
291
|
-
});
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
};
|
|
296
|
-
};
|
|
297
|
-
var index_default = createIntegration;
|
|
298
|
-
export {
|
|
299
|
-
index_default as default
|
|
300
|
-
};
|
|
301
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../../fs-utils/src/index.ts","../../../node_modules/outdent/src/index.ts","../src/plugins/patchAstroInlineScripts.ts","../src/plugins/setupContentCollectionContext.ts"],"sourcesContent":["import { fileURLToPath } from 'node:url';\nimport type { WixIntegration } from '@wix/astro-core';\nimport { normalizePath } from '@wix/fs-utils';\nimport { outdent } from 'outdent';\nimport { patchAstroInlineScripts } from './plugins/patchAstroInlineScripts.js';\nimport { setupContentCollectionContext } from './plugins/setupContentCollectionContext.js';\n\nconst setupContextUrl = new URL(\n '../build-browser-runtime/setup.js',\n import.meta.url\n);\n\nconst createIntegration = ({\n enableAuthRoutes,\n}: {\n enableAuthRoutes: boolean;\n}): WixIntegration => {\n return {\n name: '@wix/astro/auth',\n hooks: {\n 'astro:config:setup'({\n addMiddleware,\n config,\n injectRoute,\n injectScript,\n updateConfig,\n }) {\n const srcDir = fileURLToPath(config.srcDir);\n\n updateConfig({\n vite: {\n plugins: [\n setupContentCollectionContext(srcDir),\n patchAstroInlineScripts(),\n ],\n },\n });\n\n const setupContextCode = outdent`\n import { WIX_CLIENT_ID } from 'astro:env/client';\n import { setup } from '${normalizePath(setupContextUrl)}';\n\n setup({ clientId: WIX_CLIENT_ID });\n `;\n\n // support client-side context calls\n injectScript('before-hydration', setupContextCode);\n injectScript('page', setupContextCode);\n\n // support server side context calls\n addMiddleware({\n entrypoint: new URL(\n '../build-runtime/middleware/auth.js',\n import.meta.url\n ),\n order: 'pre',\n });\n\n // support built-in auth routes\n if (enableAuthRoutes) {\n injectRoute({\n entrypoint: new URL(\n '../build-runtime/routes/login.js',\n import.meta.url\n ),\n pattern: '/api/auth/login',\n prerender: false,\n });\n\n injectRoute({\n entrypoint: new URL(\n '../build-runtime/routes/logout.js',\n import.meta.url\n ),\n pattern: '/api/auth/logout',\n prerender: false,\n });\n\n injectRoute({\n entrypoint: new URL(\n '../build-runtime/routes/callback.js',\n import.meta.url\n ),\n pattern: '/api/auth/callback',\n prerender: false,\n });\n\n injectRoute({\n entrypoint: new URL(\n '../build-runtime/routes/logout-callback.js',\n import.meta.url\n ),\n pattern: '/api/auth/logout-callback',\n prerender: false,\n });\n }\n },\n },\n };\n};\n\nexport default createIntegration;\n","import {\n access,\n readFile as fsReadFile,\n mkdir,\n rm,\n writeFile,\n} from 'node:fs/promises';\nimport { EOL } from 'node:os';\nimport { dirname } from 'node:path';\nimport process from 'node:process';\nimport { fileURLToPath } from 'node:url';\n\nconst isWindows = process.platform === 'win32';\n\nexport async function clearDir(dir: string): Promise<void> {\n await rm(dir, { recursive: true });\n await mkdir(dir);\n}\n\n/**\n * Normalizes a file path (either an absolute string or a file URL) to be\n * compatible with the current OS (windows and linux).\n */\nexport function normalizePath(id: string | URL): string {\n const filePath = typeof id === 'string' ? id : fileURLToPath(id);\n return isWindows ? slash(filePath) : filePath;\n}\n\nexport async function outputDir(dir: string): Promise<void> {\n await mkdir(dir, { recursive: true });\n}\n\nexport async function pathExists(path: string): Promise<boolean> {\n return access(path)\n .then(() => true)\n .catch(() => false);\n}\n\nexport async function readJson(file: string): Promise<unknown> {\n return JSON.parse(await fsReadFile(file, 'utf-8'));\n}\n\nexport async function writeJson(\n filePath: string,\n object: unknown,\n opts: { spaces: number } = { spaces: 2 }\n): Promise<void> {\n const str = toJsonString(object, opts);\n await outputDir(dirname(filePath));\n\n await writeFile(filePath, str, 'utf-8');\n}\n\nfunction slash(path: string) {\n return path.replaceAll('\\\\', '/');\n}\n\nfunction toJsonString(object: unknown, opts?: { spaces: number }) {\n return `${JSON.stringify(object, null, opts?.spaces)}${EOL}`;\n}\n","type TODO = any;\n\n// In the absence of a WeakSet or WeakMap implementation, don't break, but don't cache either.\nfunction noop(...args: Array<any>) {}\nfunction createWeakMap<K extends object, V>(): MyWeakMap<K, V> {\n if (typeof WeakMap !== \"undefined\") {\n return new WeakMap<K, V>();\n } else {\n return fakeSetOrMap<K, V>();\n }\n}\n\ntype MyWeakMap<K extends object, V> = Pick<\n WeakMap<K, V>,\n \"delete\" | \"get\" | \"set\" | \"has\"\n>;\ntype MyWeakSetMap<K extends object, V> =\n & Pick<WeakMap<K, V>, \"delete\" | \"get\" | \"set\" | \"has\">\n & Pick<WeakSet<K>, \"add\">;\n\n/**\n * Creates and returns a no-op implementation of a WeakMap / WeakSet that never stores anything.\n */\nfunction fakeSetOrMap<K extends object, V = any>(): MyWeakSetMap<K, V> {\n return {\n add: noop as WeakSet<K>[\"add\"],\n delete: noop as WeakMap<K, V>[\"delete\"],\n get: noop as WeakMap<K, V>[\"get\"],\n set: noop as WeakMap<K, V>[\"set\"],\n has(k: K) {\n return false;\n },\n };\n}\n\n// Safe hasOwnProperty\nconst hop = Object.prototype.hasOwnProperty;\nconst has = function (obj: object, prop: string): boolean {\n return hop.call(obj, prop);\n};\n\n// Copy all own enumerable properties from source to target\nfunction extend<T, S extends object>(target: T, source: S) {\n type Extended = T & S;\n for (const prop in source) {\n if (has(source, prop)) {\n (target as any)[prop] = source[prop];\n }\n }\n return target as Extended;\n}\n\nconst reLeadingNewline = /^[ \\t]*(?:\\r\\n|\\r|\\n)/;\nconst reTrailingNewline = /(?:\\r\\n|\\r|\\n)[ \\t]*$/;\nconst reStartsWithNewlineOrIsEmpty = /^(?:[\\r\\n]|$)/;\nconst reDetectIndentation = /(?:\\r\\n|\\r|\\n)([ \\t]*)(?:[^ \\t\\r\\n]|$)/;\nconst reOnlyWhitespaceWithAtLeastOneNewline = /^[ \\t]*[\\r\\n][ \\t\\r\\n]*$/;\n\nfunction _outdentArray(\n strings: ReadonlyArray<string>,\n firstInterpolatedValueSetsIndentationLevel: boolean,\n options: Options,\n) {\n // If first interpolated value is a reference to outdent,\n // determine indentation level from the indentation of the interpolated value.\n let indentationLevel = 0;\n\n const match = strings[0].match(reDetectIndentation);\n if (match) {\n indentationLevel = match[1].length;\n }\n\n const reSource = `(\\\\r\\\\n|\\\\r|\\\\n).{0,${indentationLevel}}`;\n const reMatchIndent = new RegExp(reSource, \"g\");\n\n if (firstInterpolatedValueSetsIndentationLevel) {\n strings = strings.slice(1);\n }\n\n const { newline, trimLeadingNewline, trimTrailingNewline } = options;\n const normalizeNewlines = typeof newline === \"string\";\n const l = strings.length;\n const outdentedStrings = strings.map((v, i) => {\n // Remove leading indentation from all lines\n v = v.replace(reMatchIndent, \"$1\");\n // Trim a leading newline from the first string\n if (i === 0 && trimLeadingNewline) {\n v = v.replace(reLeadingNewline, \"\");\n }\n // Trim a trailing newline from the last string\n if (i === l - 1 && trimTrailingNewline) {\n v = v.replace(reTrailingNewline, \"\");\n }\n // Normalize newlines\n if (normalizeNewlines) {\n v = v.replace(/\\r\\n|\\n|\\r/g, (_) => newline as string);\n }\n return v;\n });\n return outdentedStrings;\n}\n\nfunction concatStringsAndValues(\n strings: ReadonlyArray<string>,\n values: ReadonlyArray<any>,\n): string {\n let ret = \"\";\n for (let i = 0, l = strings.length; i < l; i++) {\n ret += strings[i];\n if (i < l - 1) {\n ret += values[i];\n }\n }\n return ret;\n}\n\nfunction isTemplateStringsArray(v: any): v is TemplateStringsArray {\n return has(v, \"raw\") && has(v, \"length\");\n}\n\n/**\n * It is assumed that opts will not change. If this is a problem, clone your options object and pass the clone to\n * makeInstance\n * @param options\n * @return {outdent}\n */\nfunction createInstance(options: Options): Outdent {\n /** Cache of pre-processed template literal arrays */\n const arrayAutoIndentCache = createWeakMap<\n TemplateStringsArray,\n Array<string>\n >();\n /**\n * Cache of pre-processed template literal arrays, where first interpolated value is a reference to outdent,\n * before interpolated values are injected.\n */\n const arrayFirstInterpSetsIndentCache = createWeakMap<\n TemplateStringsArray,\n Array<string>\n >();\n\n /* tslint:disable:no-shadowed-variable */\n function outdent(\n stringsOrOptions: TemplateStringsArray,\n ...values: Array<any>\n ): string;\n function outdent(stringsOrOptions: Options): Outdent;\n function outdent(\n stringsOrOptions: TemplateStringsArray | Options,\n ...values: Array<any>\n ): string | Outdent {\n /* tslint:enable:no-shadowed-variable */\n if (isTemplateStringsArray(stringsOrOptions)) {\n const strings = stringsOrOptions;\n\n // Is first interpolated value a reference to outdent, alone on its own line, without any preceding non-whitespace?\n const firstInterpolatedValueSetsIndentationLevel =\n (values[0] === outdent || values[0] === defaultOutdent) &&\n reOnlyWhitespaceWithAtLeastOneNewline.test(strings[0]) &&\n reStartsWithNewlineOrIsEmpty.test(strings[1]);\n\n // Perform outdentation\n const cache = firstInterpolatedValueSetsIndentationLevel\n ? arrayFirstInterpSetsIndentCache\n : arrayAutoIndentCache;\n let renderedArray = cache.get(strings);\n if (!renderedArray) {\n renderedArray = _outdentArray(\n strings,\n firstInterpolatedValueSetsIndentationLevel,\n options,\n );\n cache.set(strings, renderedArray);\n }\n /** If no interpolated values, skip concatenation step */\n if (values.length === 0) {\n return renderedArray[0];\n }\n /** Concatenate string literals with interpolated values */\n const rendered = concatStringsAndValues(\n renderedArray,\n firstInterpolatedValueSetsIndentationLevel ? values.slice(1) : values,\n );\n\n return rendered;\n } else {\n // Create and return a new instance of outdent with the given options\n return createInstance(\n extend(extend({}, options), stringsOrOptions || {}),\n );\n }\n }\n\n const fullOutdent = extend(outdent, {\n string(str: string): string {\n return _outdentArray([str], false, options)[0];\n },\n });\n\n return fullOutdent;\n}\n\nconst defaultOutdent = createInstance({\n trimLeadingNewline: true,\n trimTrailingNewline: true,\n});\n\nexport interface Outdent {\n /**\n * Remove indentation from a template literal.\n */\n (strings: TemplateStringsArray, ...values: Array<any>): string;\n /**\n * Create and return a new Outdent instance with the given options.\n */\n (options: Options): Outdent;\n\n /**\n * Remove indentation from a string\n */\n string(str: string): string;\n\n // /**\n // * Remove indentation from a template literal, but return a tuple of the\n // * outdented TemplateStringsArray and\n // */\n // pass(strings: TemplateStringsArray, ...values: Array<any>): [TemplateStringsArray, ...Array<any>];\n}\nexport interface Options {\n trimLeadingNewline?: boolean;\n trimTrailingNewline?: boolean;\n /**\n * Normalize all newlines in the template literal to this value.\n * \n * If `null`, newlines are left untouched.\n * \n * Newlines that get normalized are '\\r\\n', '\\r', and '\\n'.\n * \n * Newlines within interpolated values are *never* normalized.\n * \n * Although intended for normalizing to '\\n' or '\\r\\n',\n * you can also set to any string; for example ' '.\n */\n newline?: string | null;\n}\n\n// Named exports. Simple and preferred.\n// import outdent from 'outdent';\nexport default defaultOutdent;\n// import {outdent} from 'outdent';\nexport { defaultOutdent as outdent };\n\n// In CommonJS environments, enable `var outdent = require('outdent');` by\n// replacing the exports object.\n// Make sure that our replacement includes the named exports from above.\ndeclare var module: any;\nif (typeof module !== \"undefined\") {\n // In webpack harmony-modules environments, module.exports is read-only,\n // so we fail gracefully.\n try {\n module.exports = defaultOutdent;\n Object.defineProperty(defaultOutdent, \"__esModule\", { value: true });\n (defaultOutdent as any).default = defaultOutdent;\n (defaultOutdent as any).outdent = defaultOutdent;\n } catch (e) {}\n}\n","import type { PluginOption } from 'vite';\nimport { outdent } from 'outdent';\n\nexport function patchAstroInlineScripts(): PluginOption {\n return {\n name: 'patch-astro-inline-scripts',\n transform(code, id) {\n const [_filename, rawQuery] = id.split(`?`, 2);\n const query = Object.fromEntries(new URLSearchParams(rawQuery).entries());\n\n if (\n query.astro == null ||\n query.type !== 'script' ||\n query['lang.ts'] == null ||\n code === ''\n ) {\n return null;\n }\n\n return outdent`\n import 'astro:scripts/page.js';\n\n ${code}\n `;\n },\n };\n}\n","import { relative } from 'node:path';\nimport type { PluginOption } from 'vite';\nimport { normalizePath } from '@wix/fs-utils';\nimport { outdent } from 'outdent';\n\n// https://github.com/withastro/astro/blob/e0c4460c5b6cc0c19b705d81820809aef0544100/packages/astro/src/content/utils.ts#L748-L763\nconst contentCollectionFilePaths = [\n 'content.config.mjs',\n 'content.config.js',\n 'content.config.mts',\n 'content.config.ts',\n 'content/config.mjs',\n 'content/config.js',\n 'content/config.mts',\n 'content/config.ts',\n];\n\nconst setupContextualClientUrl = new URL(\n '../build-runtime/runtime/backend/setupContextualClient.js',\n import.meta.url\n);\n\nexport function setupContentCollectionContext(srcDir: string): PluginOption {\n return {\n name: 'setup-content-collection-context',\n applyToEnvironment(environment) {\n return environment.name === 'ssr';\n },\n transform(code, id) {\n const relativeId = relative(srcDir, id);\n\n const isContentCollectionFile =\n contentCollectionFilePaths.includes(relativeId);\n\n if (isContentCollectionFile) {\n return outdent`\n import '${normalizePath(setupContextualClientUrl)}';\n\n ${code}\n `;\n }\n\n return null;\n },\n };\n}\n"],"mappings":";;;;AAAA,SAAS,iBAAAA,sBAAqB;;;ACA9B;AAAA,EACE;AAAA,EACA,YAAY;AAAA,EACZ;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,WAAW;AACpB,SAAS,eAAe;AACxB,OAAO,aAAa;AACpB,SAAS,qBAAqB;AAE9B,IAAM,YAAY,QAAQ,aAAa;AAWhC,SAAS,cAAc,IAA0B;AACtD,QAAM,WAAW,OAAO,OAAO,WAAW,KAAK,cAAc,EAAE;AAC/D,SAAO,YAAY,MAAM,QAAQ,IAAI;AACvC;AA2BA,SAAS,MAAM,MAAc;AAC3B,SAAO,KAAK,WAAW,MAAM,GAAG;AAClC;;;ACpDA,SAAS,OAAI;AAAC,MAAA,OAAA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