import { Plugin } from 'vite'; import { CompilerContext } from '../context/index.ts'; import { CdnChunk } from '../publicTypes.ts'; /** * Restricted due to collisions with Lumina's dist/ folder names or * Stencil's dist/ folder names */ export declare const restrictedNamespaceNames: Set; export declare const defaultNamespace = "cdn"; export declare const defaultEntryJsName = "index"; export declare const globalCssName = "main"; /** * CDN build works by reading the lazy NPM build and bundling-in all used * dependencies (except for imports of web components from dependencies - those * are assumed to be defined in the environment separately) */ export declare function buildCdn(context: CompilerContext): Plugin | undefined; export declare function buildLoaderCode(runtimeVariableName: string, customEntrypoints: { in: string; out: string; }[]): string; /** * Transform each core-importing chunk to use $arcgis.t for loading core in * order to be both ESM and AMD CDN compatible. * * Previous solution * (https://devtopia.esri.com/WebGIS/arcgis-web-components/pull/2995) relied on * top-level await. However, due to a Safari bug * (see https://devtopia.esri.com/WebGIS/arcgis-web-components/issues/3933 * and https://bugs.webkit.org/show_bug.cgi?id=242740), we are no longer using * top-level await. * * Instead, we insert a top-level await polyfill - any module that imports core * directly or indirectly is transformed to have a promise as a default export - * such promise, once awaited, yields the actual exports of the module. * * List of other solutions considered: * https://devtopia.esri.com/WebGIS/arcgis-web-components/discussions/3999 * * @example * ```js * /// BEFORE * import { b } from "./U7MU7PMX.js"; * import { when as M } from "@arcgis/core/core/reactiveUtils.js"; * var s = class extends v { * // ... * }; * export { s as ArcgisNavigationToggle }; * * /// AFTER * import a from "./U7MU7PMX.js"; * export default $arcgis.t( * ([{ when: M }, { b }]) => { * // The "meat" of the file is kept unchanged by the transform * // (we only touch the imports, and the very last export line) * s = class extends v { * // ... * }; * // Resolve the promise by returning the exported class * return s; * }, * "core/reactiveUtils", * a, * ); * ``` */ declare function transformChunk(chunk: CdnChunk, chunks: Map): void; /** * Given set of identifiers, produce the shortest possible ASCII-only identifier. * We restrict to ASCII-range as it is faster to parse for engines. */ declare function createIdentifierGenerator(seen: Set): () => string; export declare const exportsForTests: { transformChunk: typeof transformChunk; createIdentifierGenerator: typeof createIdentifierGenerator; }; export {};