@arcgis/lumina-compiler 4.33.0-next.9 → 4.33.0-next.91

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 (139) hide show
  1. package/dist/context/index.d.ts +13 -20
  2. package/dist/context/typeScript.d.ts +2 -2
  3. package/dist/context/utils.d.ts +1 -1
  4. package/dist/dependencies/arcgisCore.d.ts +1 -1
  5. package/dist/dependencies/discover.d.ts +3 -3
  6. package/dist/dependencies/index.d.ts +2 -2
  7. package/dist/dependencies/loaders.d.ts +3 -3
  8. package/dist/dependencies/lumina.d.ts +2 -0
  9. package/dist/dependencies/stencil.d.ts +1 -1
  10. package/dist/dependencies/testSetupFiles.d.ts +1 -1
  11. package/dist/dependencies/updateLumina.d.ts +4 -4
  12. package/dist/dependencies/utils.d.ts +2 -2
  13. package/dist/docs/config.d.ts +1 -1
  14. package/dist/docs/index.d.ts +2 -2
  15. package/dist/docs/stencilDocsJson.d.ts +3 -3
  16. package/dist/docs/vsCodeCustomData/index.d.ts +2 -2
  17. package/dist/docs/vsCodeCustomData/utils.d.ts +2 -2
  18. package/dist/docs/webTypes/description.d.ts +1 -1
  19. package/dist/docs/webTypes/index.d.ts +2 -2
  20. package/dist/docs/webTypes/utils.d.ts +2 -2
  21. package/dist/entrypoints/addNonLazyImports.d.ts +2 -2
  22. package/dist/entrypoints/config.d.ts +1 -0
  23. package/dist/entrypoints/dtsUtils.d.ts +3 -3
  24. package/dist/entrypoints/findUtils.d.ts +1 -1
  25. package/dist/entrypoints/handleComponentImports.d.ts +2 -2
  26. package/dist/entrypoints/pathMapping.d.ts +1 -1
  27. package/dist/entrypoints/resolveTagName.d.ts +3 -3
  28. package/dist/extractor/apiJsonUtils.d.ts +2 -2
  29. package/dist/extractor/declaration.d.ts +1 -38
  30. package/dist/extractor/extractor.d.ts +5 -6
  31. package/dist/extractor/helpers/cssDoc.d.ts +1 -1
  32. package/dist/extractor/helpers/event.d.ts +3 -3
  33. package/dist/extractor/helpers/jsDoc.d.ts +2 -2
  34. package/dist/extractor/helpers/method.d.ts +3 -3
  35. package/dist/extractor/helpers/property.d.ts +3 -3
  36. package/dist/extractor/helpers/resolveType.d.ts +3 -3
  37. package/dist/extractor/helpers/typeValue.d.ts +2 -2
  38. package/dist/extractor/index.d.ts +3 -3
  39. package/dist/frameworkTypes/index.d.ts +2 -2
  40. package/dist/frameworkTypes/lumina.d.ts +1 -1
  41. package/dist/frameworkTypes/preact.d.ts +1 -1
  42. package/dist/frameworkTypes/react.d.ts +1 -1
  43. package/dist/frameworkTypes/stencil.d.ts +1 -1
  44. package/dist/frameworkTypes/utils.d.ts +2 -2
  45. package/dist/frameworkTypes/vanilla.d.ts +1 -1
  46. package/dist/index.d.ts +10 -10
  47. package/dist/index.js +6482 -106
  48. package/dist/jsxToLitHtml/autoAddNothing.d.ts +2 -2
  49. package/dist/jsxToLitHtml/comments.d.ts +4 -4
  50. package/dist/jsxToLitHtml/convertProps.d.ts +5 -6
  51. package/dist/jsxToLitHtml/imports.d.ts +2 -2
  52. package/dist/jsxToLitHtml/index.d.ts +1 -1
  53. package/dist/jsxToLitHtml/inferPropType.d.ts +3 -3
  54. package/dist/jsxToLitHtml/insertRepeatCall.d.ts +2 -2
  55. package/dist/jsxToLitHtml/jsxVisitor.d.ts +3 -4
  56. package/dist/jsxToLitHtml/templateParts.d.ts +2 -2
  57. package/dist/jsxToLitHtml/throwOnImportingExternalized.d.ts +1 -1
  58. package/dist/jsxToLitHtml/types.d.ts +5 -4
  59. package/dist/jsxToLitHtml/utils.d.ts +1 -0
  60. package/dist/loader/hideUntilHydrated.d.ts +1 -1
  61. package/dist/loader/index.d.ts +2 -2
  62. package/dist/loader/lazy.d.ts +3 -3
  63. package/dist/loader/storybookApiJson.d.ts +1 -1
  64. package/dist/plugins/buildCdn.d.ts +72 -6
  65. package/dist/plugins/buildStencilHydrate.d.ts +2 -2
  66. package/dist/plugins/buildWebApp.d.ts +3 -0
  67. package/dist/plugins/buildWrappers.d.ts +2 -2
  68. package/dist/plugins/configureVite.d.ts +4 -4
  69. package/dist/plugins/externalizeDependencies.d.ts +2 -6
  70. package/dist/plugins/handleDynamicAssets.d.ts +2 -2
  71. package/dist/plugins/handleStaticAssets.d.ts +2 -2
  72. package/dist/plugins/loadLitCss.d.ts +2 -6
  73. package/dist/plugins/printTotalBuildSize.d.ts +2 -2
  74. package/dist/plugins/provideAssets.d.ts +3 -20
  75. package/dist/plugins/setAssetsPath.d.ts +2 -2
  76. package/dist/plugins/updatePackageJson.d.ts +3 -3
  77. package/dist/publicTypes.d.ts +25 -13
  78. package/dist/puppeteerTesting/globalSetup.d.ts +2 -2
  79. package/dist/puppeteerTesting/globalSetup.js +105 -2
  80. package/dist/puppeteerTesting/index.d.ts +7 -8
  81. package/dist/puppeteerTesting/index.js +1129 -5
  82. package/dist/puppeteerTesting/injected.d.ts +1 -1
  83. package/dist/puppeteerTesting/puppeteer/browser.d.ts +1 -1
  84. package/dist/puppeteerTesting/puppeteer/element.d.ts +3 -3
  85. package/dist/puppeteerTesting/puppeteer/events.d.ts +2 -2
  86. package/dist/puppeteerTesting/puppeteer/page.d.ts +1 -1
  87. package/dist/puppeteerTesting/puppeteer/types.d.ts +3 -3
  88. package/dist/puppeteerTesting/vitest/matchers/attributes.d.ts +1 -1
  89. package/dist/puppeteerTesting/vitest/matchers/classList.d.ts +1 -1
  90. package/dist/puppeteerTesting/vitest/matchers/events.d.ts +1 -1
  91. package/dist/puppeteerTesting/vitest/matchers/index.d.ts +13 -13
  92. package/dist/puppeteerTesting/vitest/matchers/text.d.ts +1 -1
  93. package/dist/puppeteerTesting/vitest/runner.d.ts +3 -3
  94. package/dist/puppeteerTesting/vitest/runner.js +50 -1
  95. package/dist/puppeteerTesting/vitest/types.d.ts +1 -1
  96. package/dist/testing/index.d.ts +4 -4
  97. package/dist/testing/index.js +181 -24
  98. package/dist/testing/mount.d.ts +2 -2
  99. package/dist/testing/wrapController.d.ts +2 -2
  100. package/dist/tests/utils.d.ts +2 -2
  101. package/dist/transformers/index.d.ts +3 -3
  102. package/dist/transformers/injectRuntimeOptions.d.ts +2 -2
  103. package/dist/transformers/internalTypeScriptApis.d.ts +2 -2
  104. package/dist/transformers/liftDecorators.d.ts +1 -1
  105. package/dist/transformers/members.d.ts +2 -2
  106. package/dist/transformers/property.d.ts +4 -4
  107. package/dist/transformers/propertyOptions.d.ts +5 -5
  108. package/dist/transformers/utils.d.ts +3 -3
  109. package/dist/types/astTransformers.d.ts +2 -2
  110. package/dist/types/failOnJsonImport.d.ts +1 -1
  111. package/dist/types/hideInternalLitElement.d.ts +1 -1
  112. package/dist/types/index.d.ts +2 -2
  113. package/dist/types/liftSetterTypes.d.ts +2 -3
  114. package/dist/types/textTransformers.d.ts +2 -2
  115. package/dist/types/transformComponentMembers.d.ts +1 -1
  116. package/dist/types-C3YmWTVv.js +13 -0
  117. package/dist/useLumina.d.ts +1 -1
  118. package/package.json +6 -5
  119. package/dist/chunk-6XNX5V4L.js +0 -1
  120. package/dist/chunk-JFKSI6I7.js +0 -1
  121. package/dist/context/typeScript.spec.d.ts +0 -1
  122. package/dist/context/utils.spec.d.ts +0 -1
  123. package/dist/defaultAssetsUrl.spec.d.ts +0 -1
  124. package/dist/dependencies/lit.d.ts +0 -2
  125. package/dist/dependencies/updateLumina.spec.d.ts +0 -1
  126. package/dist/docs/steniclDocsJson.test.d.ts +0 -1
  127. package/dist/entrypoints/dtsUtils.spec.d.ts +0 -1
  128. package/dist/entrypoints/findUtils.spec.d.ts +0 -1
  129. package/dist/entrypoints/resolveTagName.spec.d.ts +0 -1
  130. package/dist/extractor/declaration.spec.d.ts +0 -1
  131. package/dist/extractor/helpers/cssDoc.spec.d.ts +0 -1
  132. package/dist/extractor/helpers/resolveType.spec.d.ts +0 -1
  133. package/dist/extractor/helpers/typeValue.spec.d.ts +0 -1
  134. package/dist/jsxToLitHtml/utils.spec.d.ts +0 -1
  135. package/dist/loader/lazy.spec.d.ts +0 -1
  136. package/dist/plugins/buildCdn.spec.d.ts +0 -1
  137. package/dist/plugins/externalizeDependencies.spec.d.ts +0 -1
  138. package/dist/plugins/provideAssets.spec.d.ts +0 -1
  139. package/dist/plugins/updatePackageJson.spec.d.ts +0 -1
@@ -1,16 +1,16 @@
1
- import type { ConfigEnv, Plugin, ResolvedConfig, ViteDevServer } from "vite";
2
- import ts from "typescript";
3
- import type { ApiCssCustomProperty, ApiCustomElementDeclaration, ApiJson } from "@arcgis/api-extractor";
4
- import type { LuminaOptions, AssetSpec, AssetTransformer, DeclarationTextTransformer, ProvideAssetsOptions, LintingOptions } from "../publicTypes";
5
- import type { ComponentPathMapping } from "../entrypoints/pathMapping";
6
- import type { DocsType } from "../docs/types";
7
- import type { ContextDirectories } from "./types";
8
- import { makeLoaders, type computeServeOnlyDependencies } from "../dependencies/loaders";
9
- import type { CustomElementInterdependencies } from "../entrypoints/config";
10
- import type { getCompilerOptionsForPrinter } from "../transformers";
11
- import type { getPrinter } from "../transformers/internalTypeScriptApis";
12
- import type { getLocalDefinedComponentsFromApiJson } from "../entrypoints/resolveTagName";
13
- import type { Deferred } from "@arcgis/components-utils";
1
+ import { ConfigEnv, Plugin, ResolvedConfig, ViteDevServer } from 'vite';
2
+ import { default as ts } from 'typescript';
3
+ import { ApiCssCustomProperty, ApiCustomElementDeclaration, ApiJson } from '@arcgis/api-extractor';
4
+ import { LuminaOptions, AssetSpec, AssetTransformer, DeclarationTextTransformer, ProvideAssetsOptions, LintingOptions } from '../publicTypes';
5
+ import { ComponentPathMapping } from '../entrypoints/pathMapping';
6
+ import { DocsType } from '../docs/types';
7
+ import { ContextDirectories } from './types';
8
+ import { makeLoaders, computeServeOnlyDependencies } from '../dependencies/loaders';
9
+ import { CustomElementInterdependencies } from '../entrypoints/config';
10
+ import { getCompilerOptionsForPrinter } from '../transformers';
11
+ import { getPrinter } from '../transformers/internalTypeScriptApis';
12
+ import { getLocalDefinedComponentsFromApiJson } from '../entrypoints/resolveTagName';
13
+ import { Deferred } from '@arcgis/components-utils';
14
14
  export declare class CompilerContext {
15
15
  /**
16
16
  * The path to the resolved TypeScript configuration
@@ -311,13 +311,6 @@ export declare class CompilerContext {
311
311
  regex: RegExp;
312
312
  replacements: Record<string, string>;
313
313
  };
314
- /**
315
- * Mapping between component tag name and public properties in that component
316
- * whose type depends on another property.
317
- *
318
- * @private
319
- */
320
- _typeDependencies: Map<string, Set<string>>;
321
314
  private _silencedRules;
322
315
  /**
323
316
  * Promise that resolves once src/lumina.ts is updated
@@ -1,5 +1,5 @@
1
- import ts from "typescript";
2
- import type { CompilerContext } from ".";
1
+ import { default as ts } from 'typescript';
2
+ import { CompilerContext } from '.';
3
3
  /**
4
4
  * In build mode, vite-plugin-dts already parses tsconfig. However, it
5
5
  * overwrites the resolved tsconfig.target with ESNext, which is not what we
@@ -1,4 +1,4 @@
1
- export declare function inferPreamble(packageJson?: import("@arcgis/components-build-utils").MiniPackageJson): string;
1
+ export declare function inferPreamble(packageJson?: import('@arcgis/components-build-utils').MiniPackageJson): string;
2
2
  export declare const preambleToComment: (preamble: string) => string;
3
3
  export declare const throwOnReadBeforeSet: (createdDuring: string) => PropertyDecorator;
4
4
  export declare function normalizeDocumentationFileName(fileName: string): string;
@@ -1,4 +1,4 @@
1
- import { type DependencyInjectionMode, type DependencyInjectionResult } from "./utils";
1
+ import { DependencyInjectionMode, DependencyInjectionResult } from './utils';
2
2
  export declare const hasCore: boolean;
3
3
  /**
4
4
  * Thanks to Vite's dependency pre-bundling, we do not have to use the CDN
@@ -1,6 +1,6 @@
1
- import type { Package } from "custom-elements-manifest/schema";
2
- import type { ModulePath } from "../extractor/helpers/resolveType";
3
- import type { WebTypes } from "../docs/webTypes/types";
1
+ import { Package } from 'custom-elements-manifest/schema';
2
+ import { ModulePath } from '../extractor/helpers/resolveType';
3
+ import { WebTypes } from '../docs/webTypes/types';
4
4
  export type ResolvedDependencyComponents = {
5
5
  readonly packageName: string;
6
6
  readonly type: "@arcgis/lumina" | "stencil" | "unknown";
@@ -1,5 +1,5 @@
1
- import type { IndexHtmlTransformContext, Plugin } from "vite";
2
- import type { CompilerContext } from "../context";
1
+ import { IndexHtmlTransformContext, Plugin } from 'vite';
2
+ import { CompilerContext } from '../context';
3
3
  export declare const doLoadersApply: (context: CompilerContext, htmlContext?: IndexHtmlTransformContext) => boolean;
4
4
  /**
5
5
  * In serve mode, augment index.html by adding the necessary script tags for
@@ -1,6 +1,6 @@
1
- import type { CompilerContext } from "../context";
2
- import { type ResolvedDependencyComponents } from "./discover";
3
- import type { DependencyInjectionResult } from "./utils";
1
+ import { CompilerContext } from '../context';
2
+ import { ResolvedDependencyComponents } from './discover';
3
+ import { DependencyInjectionResult } from './utils';
4
4
  export declare function makeLoaders(context: CompilerContext): Promise<DependencyInjectionResult[]>;
5
5
  export declare const silenceLitWarnings: {
6
6
  optimizableImports: never[];
@@ -0,0 +1,2 @@
1
+ import { DependencyInjectionMode, DependencyInjectionResult } from './utils';
2
+ export declare function makeLuminaLoader(baseUrl: string, packageName: string, mode: DependencyInjectionMode, index: number): Promise<DependencyInjectionResult>;
@@ -1,4 +1,4 @@
1
- import { type DependencyInjectionMode, type DependencyInjectionResult } from "./utils";
1
+ import { DependencyInjectionMode, DependencyInjectionResult } from './utils';
2
2
  export declare function makeStencilLoader(baseUrl: string, packageName: string, mode: DependencyInjectionMode, index: number): Promise<DependencyInjectionResult[]>;
3
3
  export declare function findCdnFiles(distDirectory: string): Promise<{
4
4
  readonly cdnName: string;
@@ -1,4 +1,4 @@
1
- import type { CompilerContext } from "../context";
1
+ import { CompilerContext } from '../context';
2
2
  export declare const testLitSetupFileName = "/@arcgis/lumina-compiler/testLitSetupFile";
3
3
  /**
4
4
  * For browser tests, this file lazy-loads all dependencies, and then the
@@ -1,7 +1,7 @@
1
- import type { ResolvedDependencyComponents } from "./discover";
2
- import type { BrowserConfigOptions } from "vitest/node";
3
- export declare function updateLuminaTs(dependencies: readonly ResolvedDependencyComponents[], srcDir: string, hasCore: boolean, browserProvider?: BrowserConfigOptions["provider"], packageJson?: import("@arcgis/components-build-utils").MiniPackageJson): Promise<boolean>;
4
- declare function produceLuminaTs(dependencies: readonly ResolvedDependencyComponents[], hasCore: boolean, browserProvider?: BrowserConfigOptions["provider"], packageJson?: import("@arcgis/components-build-utils").MiniPackageJson): string;
1
+ import { ResolvedDependencyComponents } from './discover';
2
+ import { BrowserConfigOptions } from 'vitest/node';
3
+ export declare function updateLuminaTs(dependencies: readonly ResolvedDependencyComponents[], srcDir: string, hasCore: boolean, browserProvider?: BrowserConfigOptions["provider"], packageJson?: import('@arcgis/components-build-utils').MiniPackageJson): Promise<boolean>;
4
+ declare function produceLuminaTs(dependencies: readonly ResolvedDependencyComponents[], hasCore: boolean, browserProvider?: BrowserConfigOptions["provider"], packageJson?: import('@arcgis/components-build-utils').MiniPackageJson): string;
5
5
  export declare const exportsForTests: {
6
6
  produceLuminaTs: typeof produceLuminaTs;
7
7
  };
@@ -1,5 +1,5 @@
1
- import type { HtmlTagDescriptor } from "vite";
2
- export type DependencyInjectionMode = "lazy" | "storybookBuild";
1
+ import { HtmlTagDescriptor } from 'vite';
2
+ export type DependencyInjectionMode = "cdn" | "lazyNpm";
3
3
  export type DependencyInjectionResult = HtmlTagDescriptor | {
4
4
  cssHref: string;
5
5
  id?: string;
@@ -1,2 +1,2 @@
1
- import type { DocsType } from "./types";
1
+ import { DocsType } from './types';
2
2
  export declare const defaultDocsFileNames: Record<DocsType, string>;
@@ -1,5 +1,5 @@
1
- import type { CompilerContext } from "../context";
2
- import type { Plugin } from "vite";
1
+ import { CompilerContext } from '../context';
2
+ import { Plugin } from 'vite';
3
3
  /**
4
4
  * Generate JSON component metadata in 4 formats ()
5
5
  * - community standard
@@ -1,6 +1,6 @@
1
- import type { ComponentCompilerTypeReferences } from "@stencil/core/internal";
2
- import type { CompilerContext } from "../context";
3
- import { type ApiDocsTag } from "@arcgis/api-extractor";
1
+ import { ComponentCompilerTypeReferences } from '@stencil/core/internal';
2
+ import { CompilerContext } from '../context';
3
+ import { ApiDocsTag } from '@arcgis/api-extractor';
4
4
  /**
5
5
  * To avoid having a dependency on Stencil, we inline Stencil types rather than
6
6
  * importing them.
@@ -1,5 +1,5 @@
1
- import type { VsCodeHtmlDocs, VsCodeCssDocs } from "./types.js";
2
- import type { ApiCustomElementDeclaration } from "@arcgis/api-extractor";
1
+ import { VsCodeHtmlDocs, VsCodeCssDocs } from './types.js';
2
+ import { ApiCustomElementDeclaration } from '@arcgis/api-extractor';
3
3
  /**
4
4
  * Originally based on
5
5
  * https://github.com/break-stuff/cem-tools/tree/main/packages/vs-code-integration
@@ -1,3 +1,3 @@
1
- import type { VsCodeTag } from "./types";
2
- import { type ApiCustomElementDeclaration } from "@arcgis/api-extractor";
1
+ import { VsCodeTag } from './types';
2
+ import { ApiCustomElementDeclaration } from '@arcgis/api-extractor';
3
3
  export declare const getTagList: (components: ApiCustomElementDeclaration[]) => VsCodeTag[];
@@ -1,4 +1,4 @@
1
- import { type ApiClassMember, type ApiCssCustomProperty, type ApiCssPart, type ApiCustomElementDeclaration, type ApiEvent, type ApiSlot } from "@arcgis/api-extractor";
1
+ import { ApiClassMember, ApiCssCustomProperty, ApiCssPart, ApiCustomElementDeclaration, ApiEvent, ApiSlot } from '@arcgis/api-extractor';
2
2
  export declare function getComponentDetailsTemplate(component: ApiCustomElementDeclaration): string;
3
3
  export declare const getSlotsTemplate: (slots?: ApiSlot[]) => string;
4
4
  export declare const getEventsTemplate: (events?: ApiEvent[]) => string;
@@ -1,5 +1,5 @@
1
- import type { WebTypesOptions, WebTypesElement, WebTypes } from "./types";
2
- import { type ApiCustomElementDeclaration } from "@arcgis/api-extractor";
1
+ import { WebTypesOptions, WebTypesElement, WebTypes } from './types';
2
+ import { ApiCustomElementDeclaration } from '@arcgis/api-extractor';
3
3
  /**
4
4
  * Originally based on
5
5
  * https://github.com/break-stuff/cem-tools/tree/main/packages/jet-brains-integration
@@ -1,5 +1,5 @@
1
- import type { ApiCustomElementDeclaration } from "@arcgis/api-extractor";
2
- import type { WebTypesAttribute, WebTypesCssProperty, WebTypesPseudoElement } from "./types";
1
+ import { ApiCustomElementDeclaration } from '@arcgis/api-extractor';
2
+ import { WebTypesAttribute, WebTypesCssProperty, WebTypesPseudoElement } from './types';
3
3
  export declare const getCssPropertyList: (components: ApiCustomElementDeclaration[]) => WebTypesCssProperty[];
4
4
  export declare const getCssPartList: (components: ApiCustomElementDeclaration[]) => WebTypesPseudoElement[];
5
5
  export declare const getComponentAttributes: (component: ApiCustomElementDeclaration) => WebTypesAttribute[];
@@ -1,5 +1,5 @@
1
- import type { Plugin } from "vite";
2
- import type { CompilerContext } from "../context";
1
+ import { Plugin } from 'vite';
2
+ import { CompilerContext } from '../context';
3
3
  /**
4
4
  * When component is imported in a non-lazy-loading way, we need to make sure
5
5
  * the component file has explicit import statements for all web component it
@@ -13,6 +13,7 @@ export type CustomElementInterdependencies = Record<string, {
13
13
  * will be added to those components instead of this file.
14
14
  */
15
15
  referencedTagNames: string[];
16
+ referencedDeferredTagNames: string[];
16
17
  readonly referencedBy: string[];
17
18
  }>;
18
19
  export declare const defaultBrowserTestProvider = "playwright";
@@ -1,6 +1,6 @@
1
- import type { DeclarationTextTransformer } from "../publicTypes";
2
- import { path } from "@arcgis/components-build-utils";
3
- import type { CompilerContext } from "../context";
1
+ import { DeclarationTextTransformer } from '../publicTypes';
2
+ import { path } from '@arcgis/components-build-utils';
3
+ import { CompilerContext } from '../context';
4
4
  export declare const rewriteDtsComponentFileNames: DeclarationTextTransformer;
5
5
  export declare const rePath: RegExp;
6
6
  /**
@@ -1,4 +1,4 @@
1
- import type { CompilerContext } from "../context";
1
+ import { CompilerContext } from '../context';
2
2
  /**
3
3
  * Create a separate entrypoint for each component to allow consuming
4
4
  * applications to only load the necessary code.
@@ -1,5 +1,5 @@
1
- import type ts from "typescript";
2
- import type { JsxContext } from "../jsxToLitHtml/types";
1
+ import { default as ts } from 'typescript';
2
+ import { JsxContext } from '../jsxToLitHtml/types';
3
3
  /**
4
4
  * Instead of adding imports to the component source file, take note of imports
5
5
  * that need to be added and have addNonLazyImports() add them to component's
@@ -1,4 +1,4 @@
1
- import type { CompilerContext } from "../context";
1
+ import { CompilerContext } from '../context';
2
2
  /**
3
3
  * A mapping between a path to a component folder in src/components and it's
4
4
  * tag name.
@@ -1,6 +1,6 @@
1
- import type { ResolvedDependencyComponent } from "../dependencies/discover";
2
- import type { ModulePath } from "../extractor/helpers/resolveType";
3
- import type { CompilerContext } from "../context";
1
+ import { ResolvedDependencyComponent } from '../dependencies/discover';
2
+ import { ModulePath } from '../extractor/helpers/resolveType';
3
+ import { CompilerContext } from '../context';
4
4
  /**
5
5
  * Automatically add imports as appropriate for all referenced internally defined
6
6
  * and externally defined custom elements
@@ -1,4 +1,4 @@
1
- import type ts from "typescript";
2
- import type { ApiClassMethod, ApiCustomElementDeclaration, ApiCustomElementField, ApiJson, ApiModule } from "@arcgis/api-extractor";
1
+ import { default as ts } from 'typescript';
2
+ import { ApiClassMethod, ApiCustomElementDeclaration, ApiCustomElementField, ApiJson, ApiModule } from '@arcgis/api-extractor';
3
3
  export declare function findMember(component: Pick<ApiCustomElementDeclaration, "members" | "name">, memberNode: ts.AccessorDeclaration | ts.MethodDeclaration | ts.PropertyDeclaration): ApiClassMethod | ApiCustomElementField | undefined;
4
4
  export declare function findApiModule(filePath: string, rootDir: string, apiJson: ApiJson): ApiModule | undefined;
@@ -1,41 +1,4 @@
1
- /**
2
- * In order to have TypeScript be aware of your custom elements, the following
3
- * needs to be present inside the library:
4
- *
5
- * ```ts
6
- * declare global {
7
- * interface DeclareElements {
8
- * "arcgis-your-component": ArcgisYourComponent;
9
- * }
10
- * }
11
- * ```
12
- *
13
- * We can't simply add this at build time, as the above needs to be present
14
- * when your IDE or the CI type-checks the project.
15
- *
16
- * While we could add the above in a central components.d.ts file like with
17
- * Stencil, doing so may cause merge conflicts, would require having a compiler
18
- * running in the background to regenerate components.d.ts on change, and can
19
- * accidentally cause stale components.d.ts to be committed (if developer forgot
20
- * to run the build process before committing)
21
- *
22
- * So instead, we will add "declare global" inside of each component file.
23
- *
24
- * To minimize boilerplate, we are going to auto-add the `@customElement()`
25
- * decorator at build time since the "declare global" structure above has
26
- * the necessary information (the tag name and the class name), and since
27
- * decorators don't affect the runtime behavior of the component.
28
- *
29
- * While "declare global" is helpful for type checking the project itself,
30
- * for external typings, we remove it and add component declarations in
31
- * dist/index.d.ts file (along with event types and etc). This is to match
32
- * Stencil's behavior in order to minimize breaking changes on migration to
33
- * Lit.
34
- *
35
- * FEATURE: for usages in tests, allow `static override tagName = "te-st";` to define a component? and adapt transformers and plugins to look for nested components too when context.isInTest
36
- */
37
- import type { FileTransformer } from "../publicTypes";
38
- import type { DeclarationTextTransformer } from "../publicTypes";
1
+ import { FileTransformer, DeclarationTextTransformer } from '../publicTypes';
39
2
  export declare const removeDeclarationFromDts: DeclarationTextTransformer;
40
3
  export declare const addCustomElementDecoratorTransformer: FileTransformer;
41
4
  export declare function findDeclaredComponents(code: string): readonly (readonly [string, string])[] | undefined;
@@ -1,14 +1,13 @@
1
- import ts from "typescript";
2
- import { ApiExtractor } from "@arcgis/api-extractor";
3
- import type { ApiAttribute, ApiClassMethod, ApiCustomElementDeclaration, ApiCustomElementField, ApiCustomElementMember, ApiDeclaration, ApiEvent, ApiExport, ApiJson, ApiModule } from "@arcgis/api-extractor";
4
- import type { CompilerContext } from "../context";
1
+ import { default as ts } from 'typescript';
2
+ import { ApiExtractor, ApiAttribute, ApiClassMethod, ApiCustomElementDeclaration, ApiCustomElementField, ApiCustomElementMember, ApiDeclaration, ApiEvent, ApiExport, ApiJson, ApiModule, ApiReference } from '@arcgis/api-extractor';
3
+ import { CompilerContext } from '../context';
5
4
  export declare class LuminaApiExtractor extends ApiExtractor {
6
5
  context: CompilerContext;
7
6
  protected isPathOnly: boolean;
8
7
  constructor(context: CompilerContext, isPathOnly: boolean);
9
8
  protected localCssImports?: Set<string>;
10
9
  protected localDeclaredComponents: Map<string, string>;
11
- protected componentHtmlTypes: Map<string, string>;
10
+ protected indexedComponents: Map<string, ApiCustomElementDeclaration>;
12
11
  protected apiComponent: ApiCustomElementDeclaration;
13
12
  protected pairedSetter: ts.SetAccessorDeclaration | undefined;
14
13
  extract(files: readonly ts.SourceFile[]): ApiJson;
@@ -44,7 +43,7 @@ export declare class LuminaApiExtractor extends ApiExtractor {
44
43
  * needs to be in a a file named like a component
45
44
  * (src/components/name/name.tsx), even if it is not a standalone component.
46
45
  */
47
- protected inheritMembers(component: ApiCustomElementDeclaration, modules: ApiModule[], existingMembers?: Set<string>, existingAttributes?: Set<string>, existingEvents?: Set<string>): void;
46
+ protected inheritMembers(component: ApiCustomElementDeclaration, modules: ApiModule[], superClass?: ApiReference, existingMembers?: Set<string>, existingAttributes?: Set<string>, existingEvents?: Set<string>): void;
48
47
  private _resolvedInheritance;
49
48
  /**
50
49
  * Based on the superclass name, find the actual declaration in the modules.
@@ -1,4 +1,4 @@
1
- import type { ApiCssCustomProperty } from "@arcgis/api-extractor";
1
+ import { ApiCssCustomProperty } from '@arcgis/api-extractor';
2
2
  /**
3
3
  * Extract `@prop` doc tags from CSS text using the syntax matching Stencil.
4
4
  *
@@ -1,6 +1,6 @@
1
- import ts from "typescript";
2
- import type { ApiEvent } from "@arcgis/api-extractor";
3
- import type { CompilerContext } from "../../context";
1
+ import { default as ts } from 'typescript';
2
+ import { ApiEvent } from '@arcgis/api-extractor';
3
+ import { CompilerContext } from '../../context';
4
4
  /**
5
5
  * If property is an event emitter, extract event payload type and event name.
6
6
  * Even name is derived by converting property name to kebab-case.
@@ -1,5 +1,5 @@
1
- import ts from "typescript";
2
- import type { ApiCustomElementDeclaration, ApiCustomElementField, ApiDocsTag } from "@arcgis/api-extractor";
1
+ import { default as ts } from 'typescript';
2
+ import { ApiCustomElementDeclaration, ApiCustomElementField, ApiDocsTag } from '@arcgis/api-extractor';
3
3
  export declare function symbolToDocs(checker: ts.TypeChecker, symbol: ts.Signature | ts.Symbol): {
4
4
  description: ApiCustomElementField["description"];
5
5
  docsTags: ApiDocsTag[];
@@ -1,6 +1,6 @@
1
- import ts from "typescript";
2
- import type { ContextDirectories } from "../../context/types";
3
- import type { ApiClassMethod } from "@arcgis/api-extractor";
1
+ import { default as ts } from 'typescript';
2
+ import { ContextDirectories } from '../../context/types';
3
+ import { ApiClassMethod } from '@arcgis/api-extractor';
4
4
  export declare function extractComponentMethodDetails(node: ts.MethodDeclaration, method: ApiClassMethod, checker: ts.TypeChecker, sourceFile: ts.SourceFile, dirs: ContextDirectories): void;
5
5
  /**
6
6
  * Inspired by https://github.com/bennypowers/cem-plugins/blob/main/plugins/cem-plugin-async-function/index.js
@@ -1,6 +1,6 @@
1
- import ts from "typescript";
2
- import type { ApiType, ApiTypeReference } from "@arcgis/api-extractor";
3
- import type { CompilerContext } from "../../context";
1
+ import { default as ts } from 'typescript';
2
+ import { ApiType, ApiTypeReference } from '@arcgis/api-extractor';
3
+ import { CompilerContext } from '../../context';
4
4
  export declare const getComplexPropertyType: (context: CompilerContext, typeContainerNode: ts.AccessorDeclaration | ts.PropertyDeclaration, isRequired: boolean, sourceFile: ts.SourceFile) => ApiType;
5
5
  /**
6
6
  * Associate a start and end index with each type reference. Drop unresolved
@@ -1,6 +1,6 @@
1
- import ts from "typescript";
2
- import type { ContextDirectories } from "../../context/types";
3
- import { type ApiType } from "@arcgis/api-extractor";
1
+ import { default as ts } from 'typescript';
2
+ import { ContextDirectories } from '../../context/types';
3
+ import { ApiType } from '@arcgis/api-extractor';
4
4
  export declare const addPropMetadataPluginName = "@arcgis/lumina:addPropMetadata";
5
5
  export declare function resolveType(checker: ts.TypeChecker, type: ts.Type, sourceFile: ts.SourceFile, dirs: ContextDirectories, stripNullish?: boolean): ApiType;
6
6
  /**
@@ -1,5 +1,5 @@
1
- import type { ApiValue } from "@arcgis/api-extractor";
2
- import ts from "typescript";
1
+ import { ApiValue } from '@arcgis/api-extractor';
2
+ import { default as ts } from 'typescript';
3
3
  /**
4
4
  * Resolve a type annotation, using the TypeScript typechecker to convert a
5
5
  * {@link ts.Type} record to a string.
@@ -1,5 +1,5 @@
1
- import type { CompilerContext } from "../context";
2
- import type { ApiCustomElementDeclaration, ApiJson } from "@arcgis/api-extractor";
1
+ import { CompilerContext } from '../context';
2
+ import { ApiCustomElementDeclaration, ApiJson } from '@arcgis/api-extractor';
3
3
  /**
4
4
  * Build the complete api.json, either once during build, or in serve mode if
5
5
  * full-reload is needed.
@@ -9,4 +9,4 @@ export declare function buildApiJson(context: CompilerContext, isFirstGenerate:
9
9
  * Update the api.json for a single file on hot reload
10
10
  */
11
11
  export declare function patchApiJson(context: CompilerContext, fileName: string, code: string): ApiCustomElementDeclaration[] | undefined;
12
- export declare function postProcessComponent(component: ApiCustomElementDeclaration, context: CompilerContext, htmlTypeReplacements: Map<string, string>): void;
12
+ export declare function postProcessComponent(component: ApiCustomElementDeclaration, context: CompilerContext, indexedComponents: Map<string, ApiCustomElementDeclaration>): void;
@@ -1,5 +1,5 @@
1
- import type { CompilerContext } from "../context";
2
- import type { Plugin } from "vite";
1
+ import { CompilerContext } from '../context';
2
+ import { Plugin } from 'vite';
3
3
  /**
4
4
  * Generate component typings for vanilla JavaScript and JSX frameworks.
5
5
  *
@@ -1,4 +1,4 @@
1
- import type { ApiCustomElementDeclaration } from "@arcgis/api-extractor";
1
+ import { ApiCustomElementDeclaration } from '@arcgis/api-extractor';
2
2
  /**
3
3
  * @see https://github.com/preactjs/preact/issues/1180#issuecomment-643681851
4
4
  */
@@ -1,4 +1,4 @@
1
- import type { ApiCustomElementDeclaration } from "@arcgis/api-extractor";
1
+ import { ApiCustomElementDeclaration } from '@arcgis/api-extractor';
2
2
  /**
3
3
  * @see https://github.com/preactjs/preact/issues/1180#issuecomment-643681851
4
4
  * @see https://github.com/preactjs/preact/pull/1448/files
@@ -1,4 +1,4 @@
1
- import type { ApiCustomElementDeclaration } from "@arcgis/api-extractor";
1
+ import { ApiCustomElementDeclaration } from '@arcgis/api-extractor';
2
2
  /**
3
3
  * @see https://react.dev/blog/2024/04/25/react-19-upgrade-guide#the-jsx-namespace-in-typescript
4
4
  * @see https://github.com/preactjs/preact/issues/1180#issuecomment-643681851
@@ -1,4 +1,4 @@
1
- import type { ApiCustomElementDeclaration } from "@arcgis/api-extractor";
1
+ import { ApiCustomElementDeclaration } from '@arcgis/api-extractor';
2
2
  /**
3
3
  * @see https://github.com/preactjs/preact/issues/1180#issuecomment-643681851
4
4
  */
@@ -1,5 +1,5 @@
1
- import type { ApiCustomElementMember } from "@arcgis/api-extractor";
2
- import type { CompilerContext } from "../context";
1
+ import { ApiCustomElementMember } from '@arcgis/api-extractor';
2
+ import { CompilerContext } from '../context';
3
3
  /** Generate a string for importing component types */
4
4
  export declare const generateComponentTypeImports: (context: CompilerContext) => string;
5
5
  export declare const isPropertyEscapeNeeded: (name: string) => boolean;
@@ -1,3 +1,3 @@
1
- import type { ApiCustomElementDeclaration } from "@arcgis/api-extractor";
1
+ import { ApiCustomElementDeclaration } from '@arcgis/api-extractor';
2
2
  /** Add component types for HTML */
3
3
  export declare const addComponentTypes: (components: ApiCustomElementDeclaration[], indexTsCode: string, typeImports: string) => string;
package/dist/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
- export { useLumina } from "./useLumina";
2
- export type * from "./publicTypes";
3
- export { inferCdnUrl } from "./defaultAssetsUrl";
4
- export type { CompilerContext } from "./context";
5
- export { LuminaApiExtractor } from "./extractor/extractor";
6
- import { initializeComponentDependencies } from "./dependencies/discover";
7
- import { updateLuminaTs } from "./dependencies/updateLumina";
8
- import { findDeclaredComponents } from "./extractor/declaration";
1
+ import { initializeComponentDependencies } from './dependencies/discover';
2
+ import { updateLuminaTs } from './dependencies/updateLumina';
3
+ import { findDeclaredComponents } from './extractor/declaration';
4
+ export { useLumina } from './useLumina';
5
+ export type * from './publicTypes';
6
+ export { inferCdnUrl } from './defaultAssetsUrl';
7
+ export type { CompilerContext } from './context';
8
+ export { LuminaApiExtractor } from './extractor/extractor';
9
9
  /**
10
10
  * These are exposed only for usage by the @arcgis/stencil-to-lumina codemod
11
11
  *
@@ -15,8 +15,8 @@ export declare const exportsForCodemod: {
15
15
  initializeComponentDependencies: typeof initializeComponentDependencies;
16
16
  updateLuminaTs: typeof updateLuminaTs;
17
17
  propertyToAttributeMappings: {
18
- readonly common: Required<import("./jsxToLitHtml/config").ElementPropertyToAttributeMappings>;
19
- readonly perElement: Record<string, import("./jsxToLitHtml/config").ElementPropertyToAttributeMappings | undefined>;
18
+ readonly common: Required<import('./jsxToLitHtml/config').ElementPropertyToAttributeMappings>;
19
+ readonly perElement: Record<string, import('./jsxToLitHtml/config').ElementPropertyToAttributeMappings | undefined>;
20
20
  };
21
21
  findDeclaredComponents: typeof findDeclaredComponents;
22
22
  nativeEvents: Set<string>;