@wix/astro 2.10.0 → 2.11.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.
Files changed (55) hide show
  1. package/build/builders.d.ts +6 -0
  2. package/build/builders.js +42 -0
  3. package/build/builders.js.map +1 -0
  4. package/build/dependencies/astro-auth/backend-runtime/middleware/auth.js +3 -0
  5. package/build/dependencies/astro-auth/browser-runtime/setup.js +1 -1
  6. package/build/dependencies/astro-auth/index.d.ts +7 -0
  7. package/build/dependencies/astro-auth/index.js +301 -0
  8. package/build/dependencies/astro-auth/index.js.map +1 -0
  9. package/build/dependencies/astro-backend-extensions/index.d.ts +77 -0
  10. package/build/dependencies/astro-backend-extensions/index.js +7279 -0
  11. package/build/dependencies/astro-backend-extensions/index.js.map +1 -0
  12. package/build/dependencies/astro-backoffice-extensions/index.d.ts +47 -0
  13. package/build/dependencies/astro-backoffice-extensions/index.js +7159 -0
  14. package/build/dependencies/astro-backoffice-extensions/index.js.map +1 -0
  15. package/build/dependencies/astro-core/index.d.ts +95 -0
  16. package/build/dependencies/astro-core/index.js +1055 -0
  17. package/build/dependencies/astro-core/index.js.map +1 -0
  18. package/build/dependencies/astro-custom-elements-extensions/browser-runtime/index.js +14 -16
  19. package/build/dependencies/astro-custom-elements-extensions/index.d.ts +24 -0
  20. package/build/dependencies/astro-custom-elements-extensions/index.js +10082 -0
  21. package/build/dependencies/astro-custom-elements-extensions/index.js.map +1 -0
  22. package/build/dependencies/astro-embedded-scripts-extensions/browser-runtime/setupContext.js +6 -10
  23. package/build/dependencies/astro-embedded-scripts-extensions/index.d.ts +18 -0
  24. package/build/dependencies/astro-embedded-scripts-extensions/index.js +8453 -0
  25. package/build/dependencies/astro-embedded-scripts-extensions/index.js.map +1 -0
  26. package/build/dependencies/astro-html-embeds/index.d.ts +5 -0
  27. package/build/dependencies/astro-html-embeds/index.js +25 -0
  28. package/build/dependencies/astro-html-embeds/index.js.map +1 -0
  29. package/build/dependencies/astro-payment-links/index.d.ts +5 -0
  30. package/build/dependencies/astro-payment-links/index.js +42 -0
  31. package/build/dependencies/astro-payment-links/index.js.map +1 -0
  32. package/build/dependencies/astro-robots/index.d.ts +5 -0
  33. package/build/dependencies/astro-robots/index.js +23 -0
  34. package/build/dependencies/astro-robots/index.js.map +1 -0
  35. package/build/dependencies/astro-site-component-panels-extensions/browser-runtime/hmr.js +26 -0
  36. package/build/dependencies/astro-site-component-panels-extensions/browser-runtime/sdk.js +12 -0
  37. package/build/dependencies/astro-site-components-extensions/browser-runtime/sdk.js +21 -0
  38. package/build/dependencies/astro-site-plugins-extensions/index.d.ts +20 -0
  39. package/build/dependencies/astro-site-plugins-extensions/index.js +49 -0
  40. package/build/dependencies/astro-site-plugins-extensions/index.js.map +1 -0
  41. package/build/dependencies/astro-viewer-api/index.d.ts +5 -0
  42. package/build/dependencies/astro-viewer-api/index.js +22 -0
  43. package/build/dependencies/astro-viewer-api/index.js.map +1 -0
  44. package/build/index.d.ts +16 -0
  45. package/build/index.js +56 -0
  46. package/build/index.js.map +1 -0
  47. package/build/integration/builders.d.ts +3 -2
  48. package/build/integration/builders.js +11 -9
  49. package/build/integration/builders.js.map +1 -1
  50. package/build/integration/{chunk-JFJIM45R.js → chunk-OJIGUJIG.js} +522 -207
  51. package/build/integration/chunk-OJIGUJIG.js.map +1 -0
  52. package/build/integration/index.js +16 -14
  53. package/build/integration/index.js.map +1 -1
  54. package/package.json +5 -4
  55. package/build/integration/chunk-JFJIM45R.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/integration.ts","../../fs-utils/src/index.ts","../src/plugins/patchGlobal.ts","../src/utils/createExtensionViteConfigFactory.ts","../src/utils/createModel.ts","../../../node_modules/chalk/source/vendor/ansi-styles/index.js","../../../node_modules/chalk/source/vendor/supports-color/index.js","../../../node_modules/chalk/source/utilities.js","../../../node_modules/chalk/source/index.js","../../../node_modules/outdent/src/index.ts","../src/utils/loadEnvVars.ts","../src/utils/generateAppManifest.ts","../src/utils/generateBuildMetadata.ts","../src/builders/app.ts","../src/builders/generic-extension.ts"],"sourcesContent":["import { join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport type { AstroConfig, AstroIntegration } from 'astro';\nimport { writeJson } from '@wix/fs-utils';\nimport { envField, passthroughImageService } from 'astro/config';\nimport type { WixIntegration } from './types.js';\nimport type { Model } from './utils/createModel.js';\nimport { patchGlobal } from './plugins/patchGlobal.js';\nimport { createExtensionViteConfigFactory } from './utils/createExtensionViteConfigFactory.js';\nimport { createModel } from './utils/createModel.js';\nimport { generateAppManifest } from './utils/generateAppManifest.js';\nimport { generateBuildMetadata } from './utils/generateBuildMetadata.js';\n\nexport const createIntegration = ({\n integrations,\n}: {\n integrations: WixIntegration[];\n}): AstroIntegration => {\n let config: AstroConfig;\n let model: Model;\n\n return {\n name: '@wix/astro/core',\n hooks: {\n async 'astro:config:setup'({\n config: astroConfig,\n logger,\n updateConfig,\n }) {\n config = astroConfig;\n\n const rootDir = fileURLToPath(astroConfig.root);\n const srcDir = fileURLToPath(astroConfig.srcDir);\n\n updateConfig({\n env: {\n schema: {\n WIX_CLIENT_ID: envField.string({\n access: 'public',\n context: 'client',\n }),\n WIX_CLIENT_INSTANCE_ID: envField.string({\n access: 'secret',\n context: 'server',\n }),\n WIX_CLIENT_PUBLIC_KEY: envField.string({\n access: 'secret',\n context: 'server',\n }),\n WIX_CLIENT_SECRET: envField.string({\n access: 'secret',\n context: 'server',\n }),\n },\n },\n image: {\n domains: ['static.wixstatic.com'],\n service: passthroughImageService(),\n },\n integrations,\n vite: {\n optimizeDeps: {\n include: [\n '@wix/sdk-runtime/context',\n '@wix/dashboard/internal',\n '@wix/sdk-context',\n '@wix/sdk',\n '@wix/sdk/auth/site-session',\n '@wix/headless-site',\n '@wix/stores',\n '@wix/site',\n ],\n },\n plugins: [patchGlobal()],\n },\n });\n\n model = await createModel({ logger, rootDir, srcDir });\n\n model.on('change', async () => {\n for (const integration of integrations) {\n if (integration.hooks['wix:model:changed']) {\n await integration.hooks['wix:model:changed']({ model });\n }\n }\n });\n },\n async 'astro:config:done'() {\n for (const integration of integrations) {\n if (integration.hooks['wix:model:setup']) {\n await integration.hooks['wix:model:setup']({ model });\n }\n }\n },\n async 'astro:server:setup'({ server }) {\n server.middlewares.use(async (req, res, next) => {\n if (req.url === '/_wix/app-manifest.json') {\n const appManifest = await generateAppManifest({\n integrations,\n model,\n });\n\n res.setHeader('Content-Type', 'application/json');\n res.end(JSON.stringify(appManifest));\n\n return;\n }\n\n next();\n });\n\n for (const integration of integrations) {\n const createExtensionViteConfig = createExtensionViteConfigFactory({\n config: server.config,\n env: model.env,\n integrationName: integration.name,\n });\n\n if (integration.hooks['wix:server:setup']) {\n await integration.hooks['wix:server:setup']({\n createExtensionViteConfig,\n });\n }\n }\n },\n async 'astro:build:setup'({ target, vite }) {\n if (target === 'server') {\n return;\n }\n\n for (const integration of integrations) {\n const createExtensionViteConfig = createExtensionViteConfigFactory({\n config: vite,\n env: model.env,\n integrationName: integration.name,\n });\n\n if (integration.hooks['wix:build:setup']) {\n await integration.hooks['wix:build:setup']({\n createExtensionViteConfig,\n });\n }\n }\n },\n async 'astro:build:done'() {\n const rootDir = fileURLToPath(config.root);\n const outDir = fileURLToPath(config.outDir);\n\n const buildMetadataPath = join(rootDir, '.wix/build-metadata.json');\n const appManifestPath = join(outDir, '_wix/app-manifest.json');\n\n const buildMetadata = await generateBuildMetadata(\n appManifestPath,\n config\n );\n const appManifest = await generateAppManifest({ integrations, model });\n\n await writeJson(appManifestPath, appManifest);\n await writeJson(buildMetadataPath, buildMetadata);\n },\n },\n };\n};\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","import type { PluginOption } from 'vite';\n\n// - https://github.com/facebookarchive/draft-js/issues/2127\n// - https://github.com/facebook/fbjs/issues/290\nconst define = { global: 'window' } as const;\n\nexport function patchGlobal(): PluginOption {\n return [\n {\n name: 'fix-draft-js',\n apply: 'serve',\n config: () => ({ optimizeDeps: { esbuildOptions: { define } } }),\n },\n {\n name: 'fix-draft-js',\n apply: 'build',\n config: () => ({ esbuild: { define } }),\n },\n ];\n}\n","import { ok } from 'node:assert';\nimport { createHash } from 'node:crypto';\nimport { join } from 'node:path';\nimport type { InlineConfig, ResolvedConfig } from 'vite';\nimport { mergeConfig } from 'vite';\nimport type { CreateExtensionViteConfig } from '../types.js';\n\nlet initialServerPort = 6001;\n\nexport function createExtensionViteConfigFactory({\n config: astroConfig,\n env,\n integrationName,\n}: {\n config: InlineConfig | ResolvedConfig;\n env: Record<string, string>;\n integrationName: string;\n}): CreateExtensionViteConfig {\n return ({ name: extensionName, config: extensionConfig }) => {\n ok(astroConfig.build?.outDir != null);\n ok(!Array.isArray(extensionConfig.build?.rollupOptions?.output));\n\n const hash = createShortHash(integrationName);\n const outputDir = `_wix_${hash}-${extensionName}`;\n\n return mergeConfig(\n {\n build: {\n assetsDir: outputDir,\n emptyOutDir: false,\n outDir: astroConfig.build.outDir,\n rollupOptions: {\n output: {\n assetFileNames: join(outputDir, `[name]-[hash][extname]`),\n chunkFileNames: join(outputDir, `[name]-[hash].js`),\n entryFileNames: join(outputDir, `[name]-[hash].js`),\n format: 'esm',\n },\n },\n target: astroConfig.build.target,\n },\n cacheDir: join('node_modules', '.vite-wix', `${hash}-${extensionName}`),\n clearScreen: false,\n configFile: false,\n customLogger: astroConfig.customLogger,\n define: {\n 'import.meta.env.WIX_CLIENT_ID': JSON.stringify(env.WIX_CLIENT_ID),\n },\n root: astroConfig.root,\n server: {\n cors: true,\n port: initialServerPort++,\n },\n } satisfies InlineConfig,\n extensionConfig\n );\n };\n}\n\nfunction createShortHash(str: string) {\n return createHash('sha256').update(str).digest('hex').substring(0, 8);\n}\n","import EventEmitter from 'node:events';\nimport type { AstroIntegrationLogger } from 'astro';\nimport type { UserConfig, ViteDevServer } from 'vite';\nimport { createServer, mergeConfig } from 'vite';\nimport type { App } from '../builders/app.js';\nimport type { BaseExtension } from '../types.js';\nimport { loadEnvVars } from './loadEnvVars.js';\n\ninterface EventMap {\n change: [];\n}\n\nexport class Model extends EventEmitter<EventMap> {\n public appId: string;\n public env: Record<string, string>;\n public extensions: BaseExtension[];\n\n private server: ViteDevServer;\n\n constructor({\n appId,\n env,\n extensions,\n server,\n }: {\n appId: string;\n env: Record<string, string>;\n extensions: BaseExtension[];\n server: ViteDevServer;\n }) {\n super();\n\n this.appId = appId;\n this.env = env;\n this.extensions = extensions;\n this.server = server;\n\n this.server.watcher.on('change', async () => {\n this.extensions = await loadExtensions(this.server);\n this.emit('change');\n });\n }\n}\n\nexport async function createModel({\n logger,\n rootDir,\n srcDir,\n}: {\n logger: AstroIntegrationLogger;\n rootDir: string;\n srcDir: string;\n}): Promise<Model> {\n const { appId, env } = loadEnvVars({ logger, rootDir });\n\n const server = await getTempViteServer({\n viteConfig: {\n root: srcDir,\n },\n });\n\n const extensions = await loadExtensions(server);\n\n const model = new Model({\n appId,\n env,\n extensions,\n server,\n });\n\n return model;\n}\n\nasync function getTempViteServer({\n viteConfig,\n}: {\n viteConfig: UserConfig;\n}): Promise<ViteDevServer> {\n const tempViteServer = await createServer(\n mergeConfig(viteConfig, {\n logLevel: 'silent',\n optimizeDeps: { noDiscovery: true },\n server: {\n middlewareMode: true,\n ws: false,\n },\n ssr: { external: [] },\n })\n );\n\n return tempViteServer;\n}\n\nasync function loadExtensions(server: ViteDevServer) {\n const mod = (await server\n .ssrLoadModule('/extensions.ts')\n .catch((error: unknown) => {\n if (\n error != null &&\n typeof error === 'object' &&\n 'code' in error &&\n error.code === 'ERR_LOAD_URL'\n ) {\n return null;\n }\n\n throw error;\n })) as null | {\n default: App;\n };\n\n if (mod) {\n // @ts-expect-error hidden types\n return mod.default.extensions;\n }\n\n return [];\n}\n","const ANSI_BACKGROUND_OFFSET = 10;\n\nconst wrapAnsi16 = (offset = 0) => code => `\\u001B[${code + offset}m`;\n\nconst wrapAnsi256 = (offset = 0) => code => `\\u001B[${38 + offset};5;${code}m`;\n\nconst wrapAnsi16m = (offset = 0) => (red, green, blue) => `\\u001B[${38 + offset};2;${red};${green};${blue}m`;\n\nconst styles = {\n\tmodifier: {\n\t\treset: [0, 0],\n\t\t// 21 isn't widely supported and 22 does the same thing\n\t\tbold: [1, 22],\n\t\tdim: [2, 22],\n\t\titalic: [3, 23],\n\t\tunderline: [4, 24],\n\t\toverline: [53, 55],\n\t\tinverse: [7, 27],\n\t\thidden: [8, 28],\n\t\tstrikethrough: [9, 29],\n\t},\n\tcolor: {\n\t\tblack: [30, 39],\n\t\tred: [31, 39],\n\t\tgreen: [32, 39],\n\t\tyellow: [33, 39],\n\t\tblue: [34, 39],\n\t\tmagenta: [35, 39],\n\t\tcyan: [36, 39],\n\t\twhite: [37, 39],\n\n\t\t// Bright color\n\t\tblackBright: [90, 39],\n\t\tgray: [90, 39], // Alias of `blackBright`\n\t\tgrey: [90, 39], // Alias of `blackBright`\n\t\tredBright: [91, 39],\n\t\tgreenBright: [92, 39],\n\t\tyellowBright: [93, 39],\n\t\tblueBright: [94, 39],\n\t\tmagentaBright: [95, 39],\n\t\tcyanBright: [96, 39],\n\t\twhiteBright: [97, 39],\n\t},\n\tbgColor: {\n\t\tbgBlack: [40, 49],\n\t\tbgRed: [41, 49],\n\t\tbgGreen: [42, 49],\n\t\tbgYellow: [43, 49],\n\t\tbgBlue: [44, 49],\n\t\tbgMagenta: [45, 49],\n\t\tbgCyan: [46, 49],\n\t\tbgWhite: [47, 49],\n\n\t\t// Bright color\n\t\tbgBlackBright: [100, 49],\n\t\tbgGray: [100, 49], // Alias of `bgBlackBright`\n\t\tbgGrey: [100, 49], // Alias of `bgBlackBright`\n\t\tbgRedBright: [101, 49],\n\t\tbgGreenBright: [102, 49],\n\t\tbgYellowBright: [103, 49],\n\t\tbgBlueBright: [104, 49],\n\t\tbgMagentaBright: [105, 49],\n\t\tbgCyanBright: [106, 49],\n\t\tbgWhiteBright: [107, 49],\n\t},\n};\n\nexport const modifierNames = Object.keys(styles.modifier);\nexport const foregroundColorNames = Object.keys(styles.color);\nexport const backgroundColorNames = Object.keys(styles.bgColor);\nexport const colorNames = [...foregroundColorNames, ...backgroundColorNames];\n\nfunction assembleStyles() {\n\tconst codes = new Map();\n\n\tfor (const [groupName, group] of Object.entries(styles)) {\n\t\tfor (const [styleName, style] of Object.entries(group)) {\n\t\t\tstyles[styleName] = {\n\t\t\t\topen: `\\u001B[${style[0]}m`,\n\t\t\t\tclose: `\\u001B[${style[1]}m`,\n\t\t\t};\n\n\t\t\tgroup[styleName] = styles[styleName];\n\n\t\t\tcodes.set(style[0], style[1]);\n\t\t}\n\n\t\tObject.defineProperty(styles, groupName, {\n\t\t\tvalue: group,\n\t\t\tenumerable: false,\n\t\t});\n\t}\n\n\tObject.defineProperty(styles, 'codes', {\n\t\tvalue: codes,\n\t\tenumerable: false,\n\t});\n\n\tstyles.color.close = '\\u001B[39m';\n\tstyles.bgColor.close = '\\u001B[49m';\n\n\tstyles.color.ansi = wrapAnsi16();\n\tstyles.color.ansi256 = wrapAnsi256();\n\tstyles.color.ansi16m = wrapAnsi16m();\n\tstyles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);\n\tstyles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);\n\tstyles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);\n\n\t// From https://github.com/Qix-/color-convert/blob/3f0e0d4e92e235796ccb17f6e85c72094a651f49/conversions.js\n\tObject.defineProperties(styles, {\n\t\trgbToAnsi256: {\n\t\t\tvalue(red, green, blue) {\n\t\t\t\t// We use the extended greyscale palette here, with the exception of\n\t\t\t\t// black and white. normal palette only has 4 greyscale shades.\n\t\t\t\tif (red === green && green === blue) {\n\t\t\t\t\tif (red < 8) {\n\t\t\t\t\t\treturn 16;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (red > 248) {\n\t\t\t\t\t\treturn 231;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn Math.round(((red - 8) / 247) * 24) + 232;\n\t\t\t\t}\n\n\t\t\t\treturn 16\n\t\t\t\t\t+ (36 * Math.round(red / 255 * 5))\n\t\t\t\t\t+ (6 * Math.round(green / 255 * 5))\n\t\t\t\t\t+ Math.round(blue / 255 * 5);\n\t\t\t},\n\t\t\tenumerable: false,\n\t\t},\n\t\thexToRgb: {\n\t\t\tvalue(hex) {\n\t\t\t\tconst matches = /[a-f\\d]{6}|[a-f\\d]{3}/i.exec(hex.toString(16));\n\t\t\t\tif (!matches) {\n\t\t\t\t\treturn [0, 0, 0];\n\t\t\t\t}\n\n\t\t\t\tlet [colorString] = matches;\n\n\t\t\t\tif (colorString.length === 3) {\n\t\t\t\t\tcolorString = [...colorString].map(character => character + character).join('');\n\t\t\t\t}\n\n\t\t\t\tconst integer = Number.parseInt(colorString, 16);\n\n\t\t\t\treturn [\n\t\t\t\t\t/* eslint-disable no-bitwise */\n\t\t\t\t\t(integer >> 16) & 0xFF,\n\t\t\t\t\t(integer >> 8) & 0xFF,\n\t\t\t\t\tinteger & 0xFF,\n\t\t\t\t\t/* eslint-enable no-bitwise */\n\t\t\t\t];\n\t\t\t},\n\t\t\tenumerable: false,\n\t\t},\n\t\thexToAnsi256: {\n\t\t\tvalue: hex => styles.rgbToAnsi256(...styles.hexToRgb(hex)),\n\t\t\tenumerable: false,\n\t\t},\n\t\tansi256ToAnsi: {\n\t\t\tvalue(code) {\n\t\t\t\tif (code < 8) {\n\t\t\t\t\treturn 30 + code;\n\t\t\t\t}\n\n\t\t\t\tif (code < 16) {\n\t\t\t\t\treturn 90 + (code - 8);\n\t\t\t\t}\n\n\t\t\t\tlet red;\n\t\t\t\tlet green;\n\t\t\t\tlet blue;\n\n\t\t\t\tif (code >= 232) {\n\t\t\t\t\tred = (((code - 232) * 10) + 8) / 255;\n\t\t\t\t\tgreen = red;\n\t\t\t\t\tblue = red;\n\t\t\t\t} else {\n\t\t\t\t\tcode -= 16;\n\n\t\t\t\t\tconst remainder = code % 36;\n\n\t\t\t\t\tred = Math.floor(code / 36) / 5;\n\t\t\t\t\tgreen = Math.floor(remainder / 6) / 5;\n\t\t\t\t\tblue = (remainder % 6) / 5;\n\t\t\t\t}\n\n\t\t\t\tconst value = Math.max(red, green, blue) * 2;\n\n\t\t\t\tif (value === 0) {\n\t\t\t\t\treturn 30;\n\t\t\t\t}\n\n\t\t\t\t// eslint-disable-next-line no-bitwise\n\t\t\t\tlet result = 30 + ((Math.round(blue) << 2) | (Math.round(green) << 1) | Math.round(red));\n\n\t\t\t\tif (value === 2) {\n\t\t\t\t\tresult += 60;\n\t\t\t\t}\n\n\t\t\t\treturn result;\n\t\t\t},\n\t\t\tenumerable: false,\n\t\t},\n\t\trgbToAnsi: {\n\t\t\tvalue: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)),\n\t\t\tenumerable: false,\n\t\t},\n\t\thexToAnsi: {\n\t\t\tvalue: hex => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)),\n\t\t\tenumerable: false,\n\t\t},\n\t});\n\n\treturn styles;\n}\n\nconst ansiStyles = assembleStyles();\n\nexport default ansiStyles;\n","import process from 'node:process';\nimport os from 'node:os';\nimport tty from 'node:tty';\n\n// From: https://github.com/sindresorhus/has-flag/blob/main/index.js\n/// function hasFlag(flag, argv = globalThis.Deno?.args ?? process.argv) {\nfunction hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process.argv) {\n\tconst prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');\n\tconst position = argv.indexOf(prefix + flag);\n\tconst terminatorPosition = argv.indexOf('--');\n\treturn position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);\n}\n\nconst {env} = process;\n\nlet flagForceColor;\nif (\n\thasFlag('no-color')\n\t|| hasFlag('no-colors')\n\t|| hasFlag('color=false')\n\t|| hasFlag('color=never')\n) {\n\tflagForceColor = 0;\n} else if (\n\thasFlag('color')\n\t|| hasFlag('colors')\n\t|| hasFlag('color=true')\n\t|| hasFlag('color=always')\n) {\n\tflagForceColor = 1;\n}\n\nfunction envForceColor() {\n\tif ('FORCE_COLOR' in env) {\n\t\tif (env.FORCE_COLOR === 'true') {\n\t\t\treturn 1;\n\t\t}\n\n\t\tif (env.FORCE_COLOR === 'false') {\n\t\t\treturn 0;\n\t\t}\n\n\t\treturn env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);\n\t}\n}\n\nfunction translateLevel(level) {\n\tif (level === 0) {\n\t\treturn false;\n\t}\n\n\treturn {\n\t\tlevel,\n\t\thasBasic: true,\n\t\thas256: level >= 2,\n\t\thas16m: level >= 3,\n\t};\n}\n\nfunction _supportsColor(haveStream, {streamIsTTY, sniffFlags = true} = {}) {\n\tconst noFlagForceColor = envForceColor();\n\tif (noFlagForceColor !== undefined) {\n\t\tflagForceColor = noFlagForceColor;\n\t}\n\n\tconst forceColor = sniffFlags ? flagForceColor : noFlagForceColor;\n\n\tif (forceColor === 0) {\n\t\treturn 0;\n\t}\n\n\tif (sniffFlags) {\n\t\tif (hasFlag('color=16m')\n\t\t\t|| hasFlag('color=full')\n\t\t\t|| hasFlag('color=truecolor')) {\n\t\t\treturn 3;\n\t\t}\n\n\t\tif (hasFlag('color=256')) {\n\t\t\treturn 2;\n\t\t}\n\t}\n\n\t// Check for Azure DevOps pipelines.\n\t// Has to be above the `!streamIsTTY` check.\n\tif ('TF_BUILD' in env && 'AGENT_NAME' in env) {\n\t\treturn 1;\n\t}\n\n\tif (haveStream && !streamIsTTY && forceColor === undefined) {\n\t\treturn 0;\n\t}\n\n\tconst min = forceColor || 0;\n\n\tif (env.TERM === 'dumb') {\n\t\treturn min;\n\t}\n\n\tif (process.platform === 'win32') {\n\t\t// Windows 10 build 10586 is the first Windows release that supports 256 colors.\n\t\t// Windows 10 build 14931 is the first release that supports 16m/TrueColor.\n\t\tconst osRelease = os.release().split('.');\n\t\tif (\n\t\t\tNumber(osRelease[0]) >= 10\n\t\t\t&& Number(osRelease[2]) >= 10_586\n\t\t) {\n\t\t\treturn Number(osRelease[2]) >= 14_931 ? 3 : 2;\n\t\t}\n\n\t\treturn 1;\n\t}\n\n\tif ('CI' in env) {\n\t\tif (['GITHUB_ACTIONS', 'GITEA_ACTIONS', 'CIRCLECI'].some(key => key in env)) {\n\t\t\treturn 3;\n\t\t}\n\n\t\tif (['TRAVIS', 'APPVEYOR', 'GITLAB_CI', 'BUILDKITE', 'DRONE'].some(sign => sign in env) || env.CI_NAME === 'codeship') {\n\t\t\treturn 1;\n\t\t}\n\n\t\treturn min;\n\t}\n\n\tif ('TEAMCITY_VERSION' in env) {\n\t\treturn /^(9\\.(0*[1-9]\\d*)\\.|\\d{2,}\\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;\n\t}\n\n\tif (env.COLORTERM === 'truecolor') {\n\t\treturn 3;\n\t}\n\n\tif (env.TERM === 'xterm-kitty') {\n\t\treturn 3;\n\t}\n\n\tif (env.TERM === 'xterm-ghostty') {\n\t\treturn 3;\n\t}\n\n\tif (env.TERM === 'wezterm') {\n\t\treturn 3;\n\t}\n\n\tif ('TERM_PROGRAM' in env) {\n\t\tconst version = Number.parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);\n\n\t\tswitch (env.TERM_PROGRAM) {\n\t\t\tcase 'iTerm.app': {\n\t\t\t\treturn version >= 3 ? 3 : 2;\n\t\t\t}\n\n\t\t\tcase 'Apple_Terminal': {\n\t\t\t\treturn 2;\n\t\t\t}\n\t\t\t// No default\n\t\t}\n\t}\n\n\tif (/-256(color)?$/i.test(env.TERM)) {\n\t\treturn 2;\n\t}\n\n\tif (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {\n\t\treturn 1;\n\t}\n\n\tif ('COLORTERM' in env) {\n\t\treturn 1;\n\t}\n\n\treturn min;\n}\n\nexport function createSupportsColor(stream, options = {}) {\n\tconst level = _supportsColor(stream, {\n\t\tstreamIsTTY: stream && stream.isTTY,\n\t\t...options,\n\t});\n\n\treturn translateLevel(level);\n}\n\nconst supportsColor = {\n\tstdout: createSupportsColor({isTTY: tty.isatty(1)}),\n\tstderr: createSupportsColor({isTTY: tty.isatty(2)}),\n};\n\nexport default supportsColor;\n","// TODO: When targeting Node.js 16, use `String.prototype.replaceAll`.\nexport function stringReplaceAll(string, substring, replacer) {\n\tlet index = string.indexOf(substring);\n\tif (index === -1) {\n\t\treturn string;\n\t}\n\n\tconst substringLength = substring.length;\n\tlet endIndex = 0;\n\tlet returnValue = '';\n\tdo {\n\t\treturnValue += string.slice(endIndex, index) + substring + replacer;\n\t\tendIndex = index + substringLength;\n\t\tindex = string.indexOf(substring, endIndex);\n\t} while (index !== -1);\n\n\treturnValue += string.slice(endIndex);\n\treturn returnValue;\n}\n\nexport function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {\n\tlet endIndex = 0;\n\tlet returnValue = '';\n\tdo {\n\t\tconst gotCR = string[index - 1] === '\\r';\n\t\treturnValue += string.slice(endIndex, (gotCR ? index - 1 : index)) + prefix + (gotCR ? '\\r\\n' : '\\n') + postfix;\n\t\tendIndex = index + 1;\n\t\tindex = string.indexOf('\\n', endIndex);\n\t} while (index !== -1);\n\n\treturnValue += string.slice(endIndex);\n\treturn returnValue;\n}\n","import ansiStyles from '#ansi-styles';\nimport supportsColor from '#supports-color';\nimport { // eslint-disable-line import/order\n\tstringReplaceAll,\n\tstringEncaseCRLFWithFirstIndex,\n} from './utilities.js';\n\nconst {stdout: stdoutColor, stderr: stderrColor} = supportsColor;\n\nconst GENERATOR = Symbol('GENERATOR');\nconst STYLER = Symbol('STYLER');\nconst IS_EMPTY = Symbol('IS_EMPTY');\n\n// `supportsColor.level` → `ansiStyles.color[name]` mapping\nconst levelMapping = [\n\t'ansi',\n\t'ansi',\n\t'ansi256',\n\t'ansi16m',\n];\n\nconst styles = Object.create(null);\n\nconst applyOptions = (object, options = {}) => {\n\tif (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {\n\t\tthrow new Error('The `level` option should be an integer from 0 to 3');\n\t}\n\n\t// Detect level if not set manually\n\tconst colorLevel = stdoutColor ? stdoutColor.level : 0;\n\tobject.level = options.level === undefined ? colorLevel : options.level;\n};\n\nexport class Chalk {\n\tconstructor(options) {\n\t\t// eslint-disable-next-line no-constructor-return\n\t\treturn chalkFactory(options);\n\t}\n}\n\nconst chalkFactory = options => {\n\tconst chalk = (...strings) => strings.join(' ');\n\tapplyOptions(chalk, options);\n\n\tObject.setPrototypeOf(chalk, createChalk.prototype);\n\n\treturn chalk;\n};\n\nfunction createChalk(options) {\n\treturn chalkFactory(options);\n}\n\nObject.setPrototypeOf(createChalk.prototype, Function.prototype);\n\nfor (const [styleName, style] of Object.entries(ansiStyles)) {\n\tstyles[styleName] = {\n\t\tget() {\n\t\t\tconst builder = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]);\n\t\t\tObject.defineProperty(this, styleName, {value: builder});\n\t\t\treturn builder;\n\t\t},\n\t};\n}\n\nstyles.visible = {\n\tget() {\n\t\tconst builder = createBuilder(this, this[STYLER], true);\n\t\tObject.defineProperty(this, 'visible', {value: builder});\n\t\treturn builder;\n\t},\n};\n\nconst getModelAnsi = (model, level, type, ...arguments_) => {\n\tif (model === 'rgb') {\n\t\tif (level === 'ansi16m') {\n\t\t\treturn ansiStyles[type].ansi16m(...arguments_);\n\t\t}\n\n\t\tif (level === 'ansi256') {\n\t\t\treturn ansiStyles[type].ansi256(ansiStyles.rgbToAnsi256(...arguments_));\n\t\t}\n\n\t\treturn ansiStyles[type].ansi(ansiStyles.rgbToAnsi(...arguments_));\n\t}\n\n\tif (model === 'hex') {\n\t\treturn getModelAnsi('rgb', level, type, ...ansiStyles.hexToRgb(...arguments_));\n\t}\n\n\treturn ansiStyles[type][model](...arguments_);\n};\n\nconst usedModels = ['rgb', 'hex', 'ansi256'];\n\nfor (const model of usedModels) {\n\tstyles[model] = {\n\t\tget() {\n\t\t\tconst {level} = this;\n\t\t\treturn function (...arguments_) {\n\t\t\t\tconst styler = createStyler(getModelAnsi(model, levelMapping[level], 'color', ...arguments_), ansiStyles.color.close, this[STYLER]);\n\t\t\t\treturn createBuilder(this, styler, this[IS_EMPTY]);\n\t\t\t};\n\t\t},\n\t};\n\n\tconst bgModel = 'bg' + model[0].toUpperCase() + model.slice(1);\n\tstyles[bgModel] = {\n\t\tget() {\n\t\t\tconst {level} = this;\n\t\t\treturn function (...arguments_) {\n\t\t\t\tconst styler = createStyler(getModelAnsi(model, levelMapping[level], 'bgColor', ...arguments_), ansiStyles.bgColor.close, this[STYLER]);\n\t\t\t\treturn createBuilder(this, styler, this[IS_EMPTY]);\n\t\t\t};\n\t\t},\n\t};\n}\n\nconst proto = Object.defineProperties(() => {}, {\n\t...styles,\n\tlevel: {\n\t\tenumerable: true,\n\t\tget() {\n\t\t\treturn this[GENERATOR].level;\n\t\t},\n\t\tset(level) {\n\t\t\tthis[GENERATOR].level = level;\n\t\t},\n\t},\n});\n\nconst createStyler = (open, close, parent) => {\n\tlet openAll;\n\tlet closeAll;\n\tif (parent === undefined) {\n\t\topenAll = open;\n\t\tcloseAll = close;\n\t} else {\n\t\topenAll = parent.openAll + open;\n\t\tcloseAll = close + parent.closeAll;\n\t}\n\n\treturn {\n\t\topen,\n\t\tclose,\n\t\topenAll,\n\t\tcloseAll,\n\t\tparent,\n\t};\n};\n\nconst createBuilder = (self, _styler, _isEmpty) => {\n\t// Single argument is hot path, implicit coercion is faster than anything\n\t// eslint-disable-next-line no-implicit-coercion\n\tconst builder = (...arguments_) => applyStyle(builder, (arguments_.length === 1) ? ('' + arguments_[0]) : arguments_.join(' '));\n\n\t// We alter the prototype because we must return a function, but there is\n\t// no way to create a function with a different prototype\n\tObject.setPrototypeOf(builder, proto);\n\n\tbuilder[GENERATOR] = self;\n\tbuilder[STYLER] = _styler;\n\tbuilder[IS_EMPTY] = _isEmpty;\n\n\treturn builder;\n};\n\nconst applyStyle = (self, string) => {\n\tif (self.level <= 0 || !string) {\n\t\treturn self[IS_EMPTY] ? '' : string;\n\t}\n\n\tlet styler = self[STYLER];\n\n\tif (styler === undefined) {\n\t\treturn string;\n\t}\n\n\tconst {openAll, closeAll} = styler;\n\tif (string.includes('\\u001B')) {\n\t\twhile (styler !== undefined) {\n\t\t\t// Replace any instances already present with a re-opening code\n\t\t\t// otherwise only the part of the string until said closing code\n\t\t\t// will be colored, and the rest will simply be 'plain'.\n\t\t\tstring = stringReplaceAll(string, styler.close, styler.open);\n\n\t\t\tstyler = styler.parent;\n\t\t}\n\t}\n\n\t// We can move both next actions out of loop, because remaining actions in loop won't have\n\t// any/visible effect on parts we add here. Close the styling before a linebreak and reopen\n\t// after next line to fix a bleed issue on macOS: https://github.com/chalk/chalk/pull/92\n\tconst lfIndex = string.indexOf('\\n');\n\tif (lfIndex !== -1) {\n\t\tstring = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);\n\t}\n\n\treturn openAll + string + closeAll;\n};\n\nObject.defineProperties(createChalk.prototype, styles);\n\nconst chalk = createChalk();\nexport const chalkStderr = createChalk({level: stderrColor ? stderrColor.level : 0});\n\nexport {\n\tmodifierNames,\n\tforegroundColorNames,\n\tbackgroundColorNames,\n\tcolorNames,\n\n\t// TODO: Remove these aliases in the next major version\n\tmodifierNames as modifiers,\n\tforegroundColorNames as foregroundColors,\n\tbackgroundColorNames as backgroundColors,\n\tcolorNames as colors,\n} from './vendor/ansi-styles/index.js';\n\nexport {\n\tstdoutColor as supportsColor,\n\tstderrColor as supportsColorStderr,\n};\n\nexport default chalk;\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 { AstroIntegrationLogger } from 'astro';\nimport chalk from 'chalk';\nimport { outdent } from 'outdent';\nimport { loadEnv } from 'vite';\n\nconst wixClientIdEnvVar = 'WIX_CLIENT_ID';\n\nexport function loadEnvVars({\n logger,\n rootDir,\n}: {\n logger: AstroIntegrationLogger;\n rootDir: string;\n}): {\n appId: string;\n env: Record<string, string>;\n} {\n const env = loadEnv(process.env.NODE_ENV ?? 'development', rootDir, '');\n const appId = env[wixClientIdEnvVar];\n\n if (appId == null) {\n logger.error(\n outdent`\n Missing environment variable ${chalk.blueBright(wixClientIdEnvVar)}\n To use the Wix SDK, you must provide the ${chalk.blueBright(\n wixClientIdEnvVar\n )} environment variable.\n 💡 To pull the required environment variables from Wix, run:\n ${chalk.magenta('npx wix env pull')}\n 🔍 Need Help?\n - Visit our docs: https://dev.wix.com/docs/go-headless\n - Join the community: https://discord.com/channels/1114269395317968906/1288424190969511987\n `\n );\n\n throw new Error(\n `${chalk.magenta(\n wixClientIdEnvVar\n )} not found in loaded environment variables`\n );\n }\n\n return {\n appId,\n env,\n };\n}\n","import type { DevCenterAppManifest } from '@wix/dev-center-schemas';\nimport type { GenericExtension } from '../builders/generic-extension.js';\nimport type { WixIntegration } from '../types.js';\nimport type { Model } from './createModel.js';\n\nexport async function generateAppManifest({\n integrations,\n model,\n}: {\n integrations: WixIntegration[];\n model: Model;\n}): Promise<DevCenterAppManifest> {\n const unknownComponents = model.extensions\n .filter(\n (extension): extension is GenericExtension =>\n extension.type === 'GenericExtension'\n )\n .map((extension) => extension.options);\n\n let appManifest = {\n appId: model.appId,\n components: unknownComponents,\n } satisfies DevCenterAppManifest;\n\n for (const integration of integrations) {\n if (integration.hooks['wix:app-manifest:setup']) {\n await integration.hooks['wix:app-manifest:setup']({\n model,\n updateAppManifest: (newAppManifest) => {\n appManifest = {\n ...appManifest,\n ...newAppManifest,\n components: [\n ...appManifest.components,\n ...(newAppManifest.components ?? []),\n ],\n };\n },\n });\n }\n }\n\n return appManifest;\n}\n","import { fileURLToPath } from 'node:url';\nimport type { AstroConfig } from 'astro';\nimport { pathExists } from '@wix/fs-utils';\nimport type { BuildMetadata } from '../types.js';\n\nexport async function generateBuildMetadata(\n appManifestPath: string,\n config: AstroConfig\n): Promise<BuildMetadata> {\n const outDir = fileURLToPath(config.outDir);\n const buildClientDir = fileURLToPath(config.build.client);\n const buildServerDir = fileURLToPath(config.build.server);\n\n // When there are only static assets, everything is under the out dir.\n // When there are static and server, the output is in the appropriate folders\n const clientDir = (await pathExists(buildClientDir))\n ? buildClientDir\n : outDir;\n\n // In SSG (static site generation) mode, there is no `serverDir`, only the client side output.\n const serverDir = (await pathExists(buildServerDir))\n ? buildServerDir\n : undefined;\n\n return {\n appManifestPath,\n clientDir,\n outDir,\n serverDir,\n };\n}\n","import type { BaseExtension } from '../types.js';\n\nexport class App {\n private extensions: BaseExtension[] = [];\n\n public use(extension: BaseExtension): this {\n this.extensions.push(extension);\n return this;\n }\n}\n\nexport function app(): App {\n return new App();\n}\n","import type { BaseDevCenterComponent } from '@wix/dev-center-schemas';\n\nexport interface GenericExtension {\n type: 'GenericExtension';\n options: BaseDevCenterComponent;\n}\n\nexport function genericExtension(\n options: BaseDevCenterComponent\n): GenericExtension {\n return {\n type: 'GenericExtension',\n options,\n };\n}\n"],"mappings":";;;;AAAA,SAAS,QAAAA,aAAY;AACrB,SAAS,iBAAAC,sBAAqB;;;ACD9B;AAAA,EACE;AAAA,EACA,YAAY;AAAA,EACZ;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,WAAW;AACpB,SAAS,eAAe;AACxB,OAAOC,cAAa;AACpB,SAAS,qBAAqB;AAE9B,IAAM,YAAYA,SAAQ,aAAa;AAgBvC,eAAsB,UAAU,KAA4B;AAC1D,QAAM,MAAM,KAAK,EAAE,WAAW,KAAK,CAAC;AACtC;AAEA,eAAsB,WAAW,MAAgC;AAC/D,SAAO,OAAO,IAAI,EACf,KAAK,MAAM,IAAI,EACf,MAAM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,MACA,MAAM,oBAAoB,EAAE,QAAQ,KAAK,GAAG;AAC1C,YAAI,WAAW,UAAU;AACvB;AAAA,QACF;AAEA,mBAAW,eAAe,cAAc;AACtC,gBAAM,4BAA4B,iCAAiC;AAAA,YACjE,QAAQ;AAAA,YACR,KAAK,MAAM;AAAA,YACX,iBAAiB,YAAY;AAAA,UAC/B,CAAC;AAED,cAAI,YAAY,MAAM,iBAAiB,GAAG;AACxC,kBAAM,YAAY,MAAM,iBAAiB,EAAE;AAAA,cACzC;AAAA,YACF,CAAC;AAAA,UACH;AAAA,QACF;AAAA,MACF;AAAA,MACA,MAAM,qBAAqB;AACzB,cAAM,UAAUA,eAAc,OAAO,IAAI;AACzC,cAAM,SAASA,eAAc,OAAO,MAAM;AAE1C,cAAM,oBAAoBC,MAAK,SAAS,0BAA0B;AAClE,cAAM,kBAAkBA,MAAK,QAAQ,wBAAwB;AAE7D,cAAM,gBAAgB,MAAM;AAAA,UAC1B;AAAA,UACA;AAAA,QACF;AACA,cAAM,cAAc,MAAM,oBAAoB,EAAE,cAAc,MAAM,CAAC;AAErE,cAAM,UAAU,iBAAiB,WAAW;AAC5C,cAAM,UAAU,mBAAmB,aAAa;AAAA,MAClD;AAAA,IACF;AAAA,EACF;AACF;;;AahKO,IAAM,MAAN,MAAU;AAAA,EACP,aAA8B,CAAC;AAAA,EAEhC,IAAI,WAAgC;AACzC,SAAK,WAAW,KAAK,SAAS;AAC9B,WAAO;AAAA,EACT;AACF;AAEO,SAAS,MAAW;AACzB,SAAO,IAAI,IAAI;AACjB;;;ACNO,SAAS,iBACd,SACkB;AAClB,SAAO;AAAA,IACL,MAAM;AAAA,IACN;AAAA,EACF;AACF;","names":["join","fileURLToPath","process","env","outputDir","mergeConfig","process","styles","chalk","styles","env","env","mergeConfig","fileURLToPath","fileURLToPath","fileURLToPath","join"]}
@@ -42,14 +42,26 @@ function visitPrototypeChain(rootClass, visitFn) {
42
42
  }
43
43
  }
44
44
 
45
- // src/runtime/wrapCustomElement.ts
45
+ // ../astro-browser-runtime/src/sdk/site.ts
46
46
  import { createClient } from "@wix/sdk";
47
47
  import { site } from "@wix/site";
48
+ var enableClient = (applicationId) => {
49
+ const host = site.host({ applicationId });
50
+ const auth = site.auth();
51
+ const wixClient = createClient({
52
+ auth,
53
+ host
54
+ });
55
+ wixClient.enableContext("module");
56
+ return auth.getAccessTokenInjector();
57
+ };
58
+
59
+ // src/runtime/wrapCustomElement.ts
48
60
  function wrapCustomElement({
49
61
  customElement,
50
62
  tagName
51
63
  }) {
52
- const { injectAccessTokenFunction } = createContext();
64
+ const injectAccessTokenFunction = enableClient(import.meta.env.WIX_CLIENT_ID);
53
65
  Object.defineProperty(customElement.prototype, "accessTokenListener", {
54
66
  configurable: false,
55
67
  value: injectAccessTokenFunction,
@@ -57,20 +69,6 @@ function wrapCustomElement({
57
69
  });
58
70
  customElements.define(tagName, customElement);
59
71
  }
60
- function createContext() {
61
- const host = site.host({
62
- applicationId: import.meta.env.WIX_CLIENT_ID
63
- });
64
- const auth = site.auth();
65
- const wixClient = createClient({
66
- auth,
67
- host
68
- });
69
- wixClient.enableContext("module");
70
- return {
71
- injectAccessTokenFunction: auth.getAccessTokenInjector()
72
- };
73
- }
74
72
  export {
75
73
  handleHmr,
76
74
  wrapCustomElement
@@ -0,0 +1,24 @@
1
+ import { WixIntegration } from '@wix/astro-core';
2
+ import { DevCenterCustomElementBase, DevCenterCustomElementBehaviors, DevCenterCustomElementDependencies, DevCenterCustomElementInstallation, DevCenterCustomElementPresets, DevCenterCustomElementSize } from '@wix/dev-center-schemas';
3
+
4
+ declare const createIntegration: () => WixIntegration;
5
+
6
+ interface CustomElement {
7
+ type: 'CustomElement';
8
+ options: Options;
9
+ }
10
+ interface Options {
11
+ id: string;
12
+ name: string;
13
+ base: DevCenterCustomElementBase;
14
+ behaviors: DevCenterCustomElementBehaviors;
15
+ dependencies: DevCenterCustomElementDependencies;
16
+ element: string;
17
+ installation: DevCenterCustomElementInstallation;
18
+ presets?: DevCenterCustomElementPresets;
19
+ size: DevCenterCustomElementSize;
20
+ tagName: string;
21
+ }
22
+ declare function customElement(options: Options): CustomElement;
23
+
24
+ export { customElement, createIntegration as default };