@arcgis/lumina-compiler 5.2.0-next.2 → 5.2.0-next.21
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/dist/context/index.d.ts +158 -296
- package/dist/context/types.d.ts +18 -34
- package/dist/defaultAssetsUrl.d.ts +6 -6
- package/dist/dependencies/discover.d.ts +43 -35
- package/dist/dependencies/updateLumina.d.ts +10 -11
- package/dist/docs/vsCodeCustomData/types.d.ts +5 -42
- package/dist/docs/webTypes/types.d.ts +5 -76
- package/dist/index.d.ts +20 -20
- package/dist/index.js +12 -8
- package/dist/jsxToLitHtml/config.d.ts +93 -121
- package/dist/options.d.ts +675 -0
- package/dist/puppeteerTesting/index.d.ts +18 -11
- package/dist/puppeteerTesting/index.js +104 -7
- package/dist/puppeteerTesting/puppeteer/element.d.ts +250 -217
- package/dist/puppeteerTesting/puppeteer/events.d.ts +15 -21
- package/dist/puppeteerTesting/puppeteer/page.d.ts +8 -5
- package/dist/puppeteerTesting/puppeteer/types.d.ts +130 -132
- package/dist/puppeteerTesting/vitest/matchers/index.d.ts +33 -30
- package/dist/testing/index.d.ts +4 -11
- package/dist/testing/mount.d.ts +113 -93
- package/dist/testing/wrapController.d.ts +5 -11
- package/dist/useLumina.d.ts +5 -2
- package/package.json +15 -7
- package/dist/context/logger.d.ts +0 -8
- package/dist/context/typeScript.d.ts +0 -6
- package/dist/context/utils.d.ts +0 -4
- package/dist/dependencies/arcgisCore.d.ts +0 -30
- package/dist/dependencies/index.d.ts +0 -12
- package/dist/dependencies/loaders.d.ts +0 -5
- package/dist/dependencies/lumina.d.ts +0 -3
- package/dist/dependencies/stencil.d.ts +0 -17
- package/dist/dependencies/testSetupFiles.d.ts +0 -13
- package/dist/dependencies/utils.d.ts +0 -15
- package/dist/docs/config.d.ts +0 -9
- package/dist/docs/index.d.ts +0 -10
- package/dist/docs/stencilDocsJson.d.ts +0 -130
- package/dist/docs/types.d.ts +0 -1
- package/dist/docs/vsCodeCustomData/index.d.ts +0 -16
- package/dist/docs/vsCodeCustomData/utils.d.ts +0 -3
- package/dist/docs/webTypes/description.d.ts +0 -2
- package/dist/docs/webTypes/index.d.ts +0 -19
- package/dist/docs/webTypes/utils.d.ts +0 -6
- package/dist/entrypoints/addNonLazyImports.d.ts +0 -13
- package/dist/entrypoints/config.d.ts +0 -17
- package/dist/entrypoints/dtsUtils.d.ts +0 -19
- package/dist/entrypoints/findUtils.d.ts +0 -6
- package/dist/entrypoints/handleComponentImports.d.ts +0 -13
- package/dist/entrypoints/resolveTagName.d.ts +0 -18
- package/dist/jsxToLitHtml/autoAddNothing.d.ts +0 -8
- package/dist/jsxToLitHtml/comments.d.ts +0 -19
- package/dist/jsxToLitHtml/convertProps.d.ts +0 -10
- package/dist/jsxToLitHtml/imports.d.ts +0 -27
- package/dist/jsxToLitHtml/importsConfig.d.ts +0 -17
- package/dist/jsxToLitHtml/index.d.ts +0 -20
- package/dist/jsxToLitHtml/inferPropType.d.ts +0 -40
- package/dist/jsxToLitHtml/insertRepeatCall.d.ts +0 -51
- package/dist/jsxToLitHtml/jsxVisitor.d.ts +0 -15
- package/dist/jsxToLitHtml/templateParts.d.ts +0 -17
- package/dist/jsxToLitHtml/throwOnImportingExternalized.d.ts +0 -10
- package/dist/jsxToLitHtml/types.d.ts +0 -74
- package/dist/jsxToLitHtml/utils.d.ts +0 -14
- package/dist/loader/css.d.ts +0 -20
- package/dist/loader/extractor.d.ts +0 -2
- package/dist/loader/index.d.ts +0 -21
- package/dist/loader/lazy.d.ts +0 -21
- package/dist/loader/storybookApiJson.d.ts +0 -6
- package/dist/plugins/buildCdn.d.ts +0 -73
- package/dist/plugins/buildWebApp.d.ts +0 -3
- package/dist/plugins/buildWrappers.d.ts +0 -4
- package/dist/plugins/configureVite.d.ts +0 -20
- package/dist/plugins/externalizeDependencies.d.ts +0 -30
- package/dist/plugins/handleDynamicAssets.d.ts +0 -8
- package/dist/plugins/handleStaticAssets.d.ts +0 -9
- package/dist/plugins/loadLitCss.d.ts +0 -127
- package/dist/plugins/printTotalBuildSize.d.ts +0 -7
- package/dist/plugins/provideAssets.d.ts +0 -35
- package/dist/plugins/setAssetsPath.d.ts +0 -10
- package/dist/plugins/updatePackageJson.d.ts +0 -14
- package/dist/publicTypes.d.ts +0 -653
- package/dist/puppeteerTesting/globalSetup.d.ts +0 -73
- package/dist/puppeteerTesting/injected.d.ts +0 -8
- package/dist/puppeteerTesting/puppeteer/browser.d.ts +0 -6
- package/dist/puppeteerTesting/vitest/matchers/attributes.d.ts +0 -4
- package/dist/puppeteerTesting/vitest/matchers/classList.d.ts +0 -4
- package/dist/puppeteerTesting/vitest/matchers/events.d.ts +0 -7
- package/dist/puppeteerTesting/vitest/matchers/text.d.ts +0 -2
- package/dist/puppeteerTesting/vitest/matchers/utils.d.ts +0 -1
- package/dist/puppeteerTesting/vitest/runner.d.ts +0 -19
- package/dist/puppeteerTesting/vitest/setupFile.d.ts +0 -1
- package/dist/puppeteerTesting/vitest/types.d.ts +0 -6
- package/dist/testing/failOnConsole.d.ts +0 -6
- package/dist/testing/setupFile.d.ts +0 -1
- package/dist/testing/snapshotSerializer.d.ts +0 -12
- package/dist/tests/utils.d.ts +0 -4
- package/dist/transformers/customElementDeclaration.d.ts +0 -2
- package/dist/transformers/index.d.ts +0 -20
- package/dist/transformers/injectRuntimeOptions.d.ts +0 -18
- package/dist/transformers/liftDecorators.d.ts +0 -21
- package/dist/transformers/members.d.ts +0 -10
- package/dist/transformers/property.d.ts +0 -10
- package/dist/transformers/propertyOptions.d.ts +0 -110
- package/dist/transformers/utils.d.ts +0 -9
|
@@ -0,0 +1,675 @@
|
|
|
1
|
+
import type ts from "typescript";
|
|
2
|
+
import type { Plugin } from "vite";
|
|
3
|
+
import type { build as esbuildBuild } from "esbuild";
|
|
4
|
+
import type { CompilerContext } from "./context/index.js";
|
|
5
|
+
import type { WebTypesOptions } from "./docs/webTypes/types.js";
|
|
6
|
+
import type { VsCodeDocOptions } from "./docs/vsCodeCustomData/types.js";
|
|
7
|
+
import type { DependencyManagementOptions as BaseDependencyManagementOptions } from "@arcgis/components-build-utils";
|
|
8
|
+
import type { ApiExtractorPluginConfig } from "@arcgis/api-extractor/vite/plugin";
|
|
9
|
+
import type { ResolvedApiExtractorConfig } from "@arcgis/api-extractor/extractor/config";
|
|
10
|
+
import type { CopyDocDefinitions } from "@arcgis/api-extractor/extractor/extractors/copyDoc";
|
|
11
|
+
import type { ApiJson, ApiModule } from "@arcgis/api-extractor/apiJson";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* `useLumina()` returns an array of Vite plugins. The array additionally
|
|
15
|
+
* has a `context` property for accessing the compiler context.
|
|
16
|
+
*/
|
|
17
|
+
export interface LuminaPlugins extends Array<Plugin> {
|
|
18
|
+
readonly context: CompilerContext;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** Options for controlling the Lumina Compiler. */
|
|
22
|
+
export interface LuminaOptions {
|
|
23
|
+
/**
|
|
24
|
+
* Configuration for controlling the build output, dependency externalization
|
|
25
|
+
* and CDN build process.
|
|
26
|
+
*/
|
|
27
|
+
readonly build?: BuildOptions;
|
|
28
|
+
/** Configurations for controlling the types generation. */
|
|
29
|
+
readonly types?: GenerateTypesOptions;
|
|
30
|
+
/** Configurations for controlling the serve and test environment. */
|
|
31
|
+
readonly serve?: ServeEnvironmentOptions;
|
|
32
|
+
/**
|
|
33
|
+
* Configuration for Puppeteer End-to-End tests.
|
|
34
|
+
* For more options, see Vite's "testing" option.
|
|
35
|
+
* This is equivalent to the `e2e` mode in Stencil.
|
|
36
|
+
*
|
|
37
|
+
* @deprecated
|
|
38
|
+
* For new projects, use Vitest browser mode instead of Puppeteer.
|
|
39
|
+
* See documentation: https://webgis.esri.com/references/lumina/testing
|
|
40
|
+
*/
|
|
41
|
+
readonly puppeteerTesting?: PuppeteerTestingOptions;
|
|
42
|
+
/** Configurations for controlling the generation of documentation. */
|
|
43
|
+
readonly documentation?: GenerateDocumentationOptions;
|
|
44
|
+
readonly apiExtractor?: ApiExtractorPluginConfig;
|
|
45
|
+
/**
|
|
46
|
+
* Configurations for controlling the extraction of components metadata and
|
|
47
|
+
* generation of extra files such as types, docs, and wrappers.
|
|
48
|
+
*
|
|
49
|
+
* This is for advanced users who want to customize the generation of metadata
|
|
50
|
+
* files.
|
|
51
|
+
*/
|
|
52
|
+
readonly apiJson?: ApiJsonOptions;
|
|
53
|
+
/** Configuration for CSS handling. */
|
|
54
|
+
readonly css?: CssHandlingOptions;
|
|
55
|
+
/** Configuration for assets handling. */
|
|
56
|
+
readonly assets?: AssetHandlingOptions;
|
|
57
|
+
readonly linting?: LintingOptions;
|
|
58
|
+
/** @deprecated See https://discord.com/channels/1012791295170859069/1047015641225371718 */
|
|
59
|
+
readonly experimental?: { readonly stabilizeRef?: boolean; };
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface BuildOptions {
|
|
63
|
+
/** Configuration for CDN build. */
|
|
64
|
+
readonly cdn?: BuildCdnOptions;
|
|
65
|
+
/** @deprecated Use Storybook build or separate test app package. */
|
|
66
|
+
readonly webApp?: BuildWebAppOptions;
|
|
67
|
+
/** Options for externalizing or bundling in dependencies. */
|
|
68
|
+
readonly dependencies?: DependencyManagementOptions;
|
|
69
|
+
/**
|
|
70
|
+
* Legal comment to add to the top of each entrypoint.
|
|
71
|
+
* New lines are accepted.
|
|
72
|
+
* Do not include // or /* - will be added automatically.
|
|
73
|
+
*
|
|
74
|
+
* @default require("@arcgis/toolkit/string").getPreamble()
|
|
75
|
+
* @example
|
|
76
|
+
* ```js
|
|
77
|
+
* `COPYRIGHT Esri - https://js.arcgis.com/{minorVersion}/LICENSE.txt`
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
readonly preamble?: string;
|
|
81
|
+
/**
|
|
82
|
+
* Whether to include source maps even in production builds.
|
|
83
|
+
* Only set this to true if your library is open source.
|
|
84
|
+
*
|
|
85
|
+
* @default false
|
|
86
|
+
*/
|
|
87
|
+
readonly enableSourceMapsInProduction?: boolean;
|
|
88
|
+
/**
|
|
89
|
+
* Wrappers to generate.
|
|
90
|
+
*
|
|
91
|
+
* @deprecated Wrappers will be dropped in 6.0
|
|
92
|
+
*/
|
|
93
|
+
readonly wrappers?: WrappersOptions[];
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export interface BuildCdnOptions {
|
|
97
|
+
/**
|
|
98
|
+
* Whether to skip CDN build.
|
|
99
|
+
*
|
|
100
|
+
* @default false
|
|
101
|
+
* @remarks
|
|
102
|
+
* Even if CDN build is skipped, assets will still be emitted to
|
|
103
|
+
* dist/cdn-folder-name/assets
|
|
104
|
+
*/
|
|
105
|
+
readonly skip?: boolean;
|
|
106
|
+
/**
|
|
107
|
+
* @deprecated
|
|
108
|
+
* To improve CDN experience and simplify redirect handling,
|
|
109
|
+
* deprecated namespace to use consistent CDN folder and file names.
|
|
110
|
+
*
|
|
111
|
+
* Reference: https://devtopia.esri.com/WebGIS/arcgis-web-components/issues/5051#issuecomment-5482327
|
|
112
|
+
*
|
|
113
|
+
* Determines the CDN folder name and the name of the entrypoint file inside.
|
|
114
|
+
* @default "cdn"
|
|
115
|
+
*/
|
|
116
|
+
readonly namespace?: string;
|
|
117
|
+
/**
|
|
118
|
+
* To produce the CDN build, Lumina takes the dist/loader.js file and
|
|
119
|
+
* and post-processes it with ESBuild to make it ready for consumption in the
|
|
120
|
+
* browser.
|
|
121
|
+
*
|
|
122
|
+
* You can customize the options passed to ESBuild. Note, some options may
|
|
123
|
+
* conflict with the Lumina build process.
|
|
124
|
+
*
|
|
125
|
+
* @see https://esbuild.github.io/api/#overview
|
|
126
|
+
*/
|
|
127
|
+
readonly esbuildOptions?: Parameters<typeof esbuildBuild>[0];
|
|
128
|
+
/**
|
|
129
|
+
* Transform the CDN entrypoint before it is processed by ESBuild.
|
|
130
|
+
*
|
|
131
|
+
* This callback is for advanced use cases only. The build output may change
|
|
132
|
+
* between Lumina versions without prior notice.
|
|
133
|
+
*
|
|
134
|
+
* @param code
|
|
135
|
+
* @param context
|
|
136
|
+
*/
|
|
137
|
+
entrypointTransformer?(code: string, context: CompilerContext): string;
|
|
138
|
+
/**
|
|
139
|
+
* A callback for mutating CDN ESBuild output chunks before they are written
|
|
140
|
+
* to disk.
|
|
141
|
+
* This callback is for advanced use cases only. The build output may change
|
|
142
|
+
* between Lumina versions without prior notice. Using this callback may
|
|
143
|
+
* corrupt the CDN source map if it is enabled.
|
|
144
|
+
*
|
|
145
|
+
* @param chunks
|
|
146
|
+
* @param context
|
|
147
|
+
*/
|
|
148
|
+
transformer?(chunks: Map<string, CdnChunk>, context: CompilerContext): void;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/** @deprecated Use Storybook build or separate test app package. */
|
|
152
|
+
export interface BuildWebAppOptions {
|
|
153
|
+
/**
|
|
154
|
+
* If set, will produce a web app build, based on index.html files and
|
|
155
|
+
* cdn build.
|
|
156
|
+
*
|
|
157
|
+
* @deprecated Use Storybook build or a separate test app package.
|
|
158
|
+
* @default undefined
|
|
159
|
+
* @example "www"
|
|
160
|
+
* @see [Based on Stencil's www build](https://stenciljs.com/docs/www)
|
|
161
|
+
*/
|
|
162
|
+
readonly destination?: string;
|
|
163
|
+
/**
|
|
164
|
+
* @deprecated Use Storybook build or a separate test app package.
|
|
165
|
+
* @param htmlContent
|
|
166
|
+
* @param htmlFilePath
|
|
167
|
+
* @param context
|
|
168
|
+
*/
|
|
169
|
+
transformFile?(htmlContent: string, htmlFilePath: string, context: CompilerContext): string;
|
|
170
|
+
/**
|
|
171
|
+
* @deprecated Use Storybook build or a separate test app package.
|
|
172
|
+
* @param context
|
|
173
|
+
*/
|
|
174
|
+
afterBuildEnd?(context: CompilerContext): Promise<void> | void;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
export interface CdnChunk {
|
|
178
|
+
code: string;
|
|
179
|
+
/**
|
|
180
|
+
* Whether chunk is currently being processed. Used to detect cyclical imports.
|
|
181
|
+
*
|
|
182
|
+
* @internal
|
|
183
|
+
*/
|
|
184
|
+
isProcessing: boolean;
|
|
185
|
+
isAsync?: boolean;
|
|
186
|
+
oldSingleExportName?: string;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Generic type for the different kinds of wrappers.
|
|
191
|
+
*
|
|
192
|
+
* Angular wrappers have been deprecated. See:
|
|
193
|
+
* https://devtopia.esri.com/WebGIS/arcgis-web-components/discussions/1281
|
|
194
|
+
*
|
|
195
|
+
* @deprecated Wrappers will be dropped in 6.0
|
|
196
|
+
*/
|
|
197
|
+
export type WrappersOptions = React18WrapperOptions;
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Options for creating React 18 wrapper.
|
|
201
|
+
*
|
|
202
|
+
* Documentation: https://webgis.esri.com/references/lumina/build#build-wrappers
|
|
203
|
+
*
|
|
204
|
+
* @deprecated Wrappers will be dropped in 6.0
|
|
205
|
+
*/
|
|
206
|
+
export interface React18WrapperOptions {
|
|
207
|
+
/** @deprecated Wrappers will be dropped in 6.0 */
|
|
208
|
+
readonly type: "react18";
|
|
209
|
+
/**
|
|
210
|
+
* The file path to the React 18 wrapper proxies file.
|
|
211
|
+
*
|
|
212
|
+
* @example "../lumina-components-react/src/components.ts"
|
|
213
|
+
*/
|
|
214
|
+
readonly proxiesFile: string;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Options for externalizing dependencies.
|
|
219
|
+
*
|
|
220
|
+
* If Vite is running under Storybook, these options are ignored. This is
|
|
221
|
+
* because in Storybook build, unlike in a library build, we want to bundle in
|
|
222
|
+
* all dependencies (with exception of \@arcgis/core and web component
|
|
223
|
+
* dependencies, which are loaded using the ESM CDN).
|
|
224
|
+
*/
|
|
225
|
+
export interface DependencyManagementOptions extends BaseDependencyManagementOptions {
|
|
226
|
+
/**
|
|
227
|
+
* By default, Lumina will error if it encounters usage of an unknown custom
|
|
228
|
+
* element. This setting allows to silence such error if you are manually
|
|
229
|
+
* importing some custom elements.
|
|
230
|
+
*
|
|
231
|
+
* > [!IMPORTANT]
|
|
232
|
+
* >
|
|
233
|
+
* > This option is an escape hatch. Build-time optimizations are not applied
|
|
234
|
+
* > to such custom elements. Additionally, you assume the responsibility for
|
|
235
|
+
* > correctly loading the web component in lazy, non-lazy and CDN builds.
|
|
236
|
+
*
|
|
237
|
+
* @param tagName
|
|
238
|
+
* @param fileName
|
|
239
|
+
* @param context
|
|
240
|
+
* @example
|
|
241
|
+
* ```ts
|
|
242
|
+
* // Silence errors for unknown custom elements that start with "fluent-"
|
|
243
|
+
* silenceUnknownJsxElementUsage: (tagName) => tagName.startsWith("fluent-")
|
|
244
|
+
* ```
|
|
245
|
+
*/
|
|
246
|
+
silenceUnknownJsxElementUsage?(tagName: string, fileName: string, context: CompilerContext): boolean;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
export interface ServeEnvironmentOptions {
|
|
250
|
+
/**
|
|
251
|
+
* By default, web component peer dependencies and \@arcgis/core are
|
|
252
|
+
* automatically injected when you are running your package in a test
|
|
253
|
+
* or serve environment (`npx vite`, `npx vitest`, or storybook serve).
|
|
254
|
+
*
|
|
255
|
+
* If some additional web component dependencies are needed in test/serve
|
|
256
|
+
* environment only, instead of declaring those as peer dependencies, you
|
|
257
|
+
* should add them as `devDependencies` and list them here to have their
|
|
258
|
+
* custom elements loaded in the test environment.
|
|
259
|
+
*
|
|
260
|
+
* @example
|
|
261
|
+
* Your package does not depend on `@arcgis/map-components`, but for testing
|
|
262
|
+
* purposes you wish to load Map Components when testing your package in
|
|
263
|
+
* `index.html`.
|
|
264
|
+
* In such case, you can set `extraDependencies: ["@arcgis/map-components"]`
|
|
265
|
+
*/
|
|
266
|
+
readonly extraDependencies?: (DetailedExtraDependency | string)[];
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
export interface DetailedExtraDependency {
|
|
270
|
+
/** @example "@arcgis/map-config-components" */
|
|
271
|
+
readonly name: string;
|
|
272
|
+
/**
|
|
273
|
+
* Overwrite the default CDN asset path for this dependency.
|
|
274
|
+
*
|
|
275
|
+
* @param context
|
|
276
|
+
* @example (): string => `https://example.com/arcgis-components/builds/main/cdn/map-config-components/`
|
|
277
|
+
*/
|
|
278
|
+
getCdnUrl(context: CompilerContext): string;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* @deprecated
|
|
283
|
+
* For new projects, use Vitest browser mode instead of Puppeteer.
|
|
284
|
+
* See documentation: https://webgis.esri.com/references/lumina/testing
|
|
285
|
+
*/
|
|
286
|
+
export interface PuppeteerTestingOptions {
|
|
287
|
+
/**
|
|
288
|
+
* @deprecated
|
|
289
|
+
* For new projects, use Vitest browser mode instead of Puppeteer.
|
|
290
|
+
* See documentation: https://webgis.esri.com/references/lumina/testing
|
|
291
|
+
* @default false
|
|
292
|
+
*/
|
|
293
|
+
readonly enabled?: boolean;
|
|
294
|
+
/**
|
|
295
|
+
* Additional number of milliseconds to wait in each `page.waitForChanges()`
|
|
296
|
+
* call after all components re-rendered. The default in Stencil was `100ms`.
|
|
297
|
+
* Setting this to `false` will speed up the tests.
|
|
298
|
+
*
|
|
299
|
+
* @default 0
|
|
300
|
+
*/
|
|
301
|
+
readonly waitForChangesDelay?: number;
|
|
302
|
+
/**
|
|
303
|
+
* @example
|
|
304
|
+
* ```ts
|
|
305
|
+
* import type { LaunchOptions } from "puppeteer";
|
|
306
|
+
* // ...
|
|
307
|
+
* launchOptions: {
|
|
308
|
+
* args: ["--no-sandbox", "--disable-setuid-sandbox"],
|
|
309
|
+
* } satisfies LaunchOptions;
|
|
310
|
+
* ```
|
|
311
|
+
*/
|
|
312
|
+
readonly launchOptions?: Record<string, unknown>;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
export interface GenerateDocumentationOptions {
|
|
316
|
+
/** @deprecated Create "api-extractor.config.ts" and use `documentation.copyDocDefinitions` instead. [Example config](https://webgis.esri.com/references/api-extractor/tags-reference#copydoc)). */
|
|
317
|
+
readonly copyDefinitions?: CopyDocDefinitions;
|
|
318
|
+
/** @deprecated Create "api-extractor.config.ts" and use `context.apiJsonEmitPath` instead. [Example config](https://webgis.esri.com/references/api-extractor/running-standalone)). */
|
|
319
|
+
readonly apiJsonFileName?: string | false;
|
|
320
|
+
/**
|
|
321
|
+
* The name of the file to write the Stencil-like docs JSON to.
|
|
322
|
+
* For backwards compatibility.
|
|
323
|
+
*
|
|
324
|
+
* @deprecated Use api.json instead.
|
|
325
|
+
* @default "docs/docs.json"
|
|
326
|
+
* @see https://stenciljs.com/docs/docs-json
|
|
327
|
+
*/
|
|
328
|
+
readonly stencilLikeDocsJsonFileName?: string | false;
|
|
329
|
+
/** @deprecated Create "api-extractor.config.ts" and use `documentation.publicStoryUrlPrefix` instead. [Example config](https://webgis.esri.com/references/api-extractor/running-standalone)). */
|
|
330
|
+
readonly publicStoryUrlPrefix?: string;
|
|
331
|
+
/**
|
|
332
|
+
* @deprecated Create "api-extractor.config.ts" and use `documentation.getComponentDocsUrl` instead. [Example config](https://webgis.esri.com/references/api-extractor/running-standalone)).
|
|
333
|
+
* @param tagName
|
|
334
|
+
* @param className
|
|
335
|
+
*/
|
|
336
|
+
getComponentDocsUrl?(tagName: string, className: string): string | undefined;
|
|
337
|
+
/**
|
|
338
|
+
* @deprecated Create "api-extractor.config.ts" and use `documentation.getComponentDemoUrl` instead. [Example config](https://webgis.esri.com/references/api-extractor/running-standalone)).
|
|
339
|
+
* @param tagName
|
|
340
|
+
* @param className
|
|
341
|
+
*/
|
|
342
|
+
getComponentDemoUrl?(tagName: string, className: string): string | undefined;
|
|
343
|
+
/**
|
|
344
|
+
* Additional options for web component documentation for VS Code. This
|
|
345
|
+
* documentation provides intellisense when editing .html and .css files.
|
|
346
|
+
*
|
|
347
|
+
* @see https://devtopia.esri.com/WebGIS/arcgis-web-components/issues/1226
|
|
348
|
+
*/
|
|
349
|
+
readonly vsCode?: VsCodeDocOptions | false;
|
|
350
|
+
/**
|
|
351
|
+
* Additional options for the web-types.json generation
|
|
352
|
+
*
|
|
353
|
+
* @see https://github.com/JetBrains/web-types
|
|
354
|
+
*/
|
|
355
|
+
readonly jetBrains?: WebTypesOptions | false;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
export interface GenerateTypesOptions {
|
|
359
|
+
/** @deprecated Create "api-extractor.config.ts" and use `types.compilerOptions` instead. [Example config](https://webgis.esri.com/references/api-extractor/tags-reference#copydoc)). */
|
|
360
|
+
readonly compilerOptions?: ResolvedApiExtractorConfig["types"]["compilerOptions"];
|
|
361
|
+
/** @deprecated Create "api-extractor.config.ts" and use `types.typeScriptConfigPath` instead. [Example config](https://webgis.esri.com/references/api-extractor/tags-reference#copydoc)). */
|
|
362
|
+
readonly tsconfigPath?: string;
|
|
363
|
+
/**
|
|
364
|
+
* @deprecated Create "api-extractor.config.ts" and use `types.afterDiagnostic` instead. [Example config](https://webgis.esri.com/references/api-extractor/tags-reference#copydoc)).
|
|
365
|
+
* @param diagnostics
|
|
366
|
+
*/
|
|
367
|
+
afterDiagnostic?(diagnostics: readonly ts.Diagnostic[]): Promise<void> | void;
|
|
368
|
+
/**
|
|
369
|
+
* @deprecated Create "api-extractor.config.ts" and use `types.typeScriptInstanceCreated` instead. [Example config](https://webgis.esri.com/references/api-extractor/tags-reference#copydoc)).
|
|
370
|
+
* @param program
|
|
371
|
+
* @param host
|
|
372
|
+
*/
|
|
373
|
+
typeScriptInstanceCreated?(program: ts.Program, host: ts.CompilerHost): void;
|
|
374
|
+
/** @deprecated Create "api-extractor.config.ts" and use `types.declarationTextTransformers` instead. [Example config](https://webgis.esri.com/references/api-extractor/tags-reference#copydoc)). */
|
|
375
|
+
readonly declarationTextTransformers?: DeclarationTextTransformer[];
|
|
376
|
+
/**
|
|
377
|
+
* Allows to modify the .tsx files as TypeScript AST nodes before they are
|
|
378
|
+
* emitted.
|
|
379
|
+
*
|
|
380
|
+
* This is useful for advanced transformations.
|
|
381
|
+
*
|
|
382
|
+
* It is advisable that your transformer preserves as many of the original
|
|
383
|
+
* source file nodes as possible as that will help in source map generation.
|
|
384
|
+
* Thus where possible, instead of using ts.factory.create* functions, use
|
|
385
|
+
* the ts.factory.update* functions.
|
|
386
|
+
*
|
|
387
|
+
* Any changes done in this transformer will not affect the generated typings.
|
|
388
|
+
* If you wish your changes to apply to typings too, you will need to
|
|
389
|
+
* implement a separate typings transformer
|
|
390
|
+
*
|
|
391
|
+
* If you wish to modify the code as a text string rather than AST, then add
|
|
392
|
+
* a Vite plugin to your vite.config.ts that will implement a transform()
|
|
393
|
+
* hook. In such case, do not forget to generate a source map for your changes.
|
|
394
|
+
* See https://rollupjs.org/plugin-development/#source-code-transformations
|
|
395
|
+
*/
|
|
396
|
+
readonly sourceFileTransformers?: FileTransformer[];
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
/**
|
|
400
|
+
* @param original
|
|
401
|
+
* @param context
|
|
402
|
+
* @deprecated
|
|
403
|
+
*/
|
|
404
|
+
export type DeclarationTextTransformer = (original: DeclarationFile, context: CompilerContext) => DeclarationFile | false;
|
|
405
|
+
|
|
406
|
+
/** @deprecated */
|
|
407
|
+
export interface DeclarationFile {
|
|
408
|
+
filePath: string;
|
|
409
|
+
content: string;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
/**
|
|
413
|
+
* @param sourceFile
|
|
414
|
+
* @param context
|
|
415
|
+
* @example
|
|
416
|
+
* ```ts
|
|
417
|
+
* (sourceFile, context) =>
|
|
418
|
+
* context.apiModule === undefined || !sourceFile.text.includes("@method")
|
|
419
|
+
* ? sourceFile.statements
|
|
420
|
+
* : sourceFile.statements.map((statement) =>
|
|
421
|
+
* statementVisitor(statement, context)
|
|
422
|
+
* );
|
|
423
|
+
* ```
|
|
424
|
+
*/
|
|
425
|
+
export type FileTransformer = (sourceFile: ts.SourceFile, context: FileTransformContext) => readonly ts.Statement[];
|
|
426
|
+
|
|
427
|
+
export interface FileTransformContext {
|
|
428
|
+
readonly compiler: CompilerContext;
|
|
429
|
+
readonly transformation: ts.TransformationContext;
|
|
430
|
+
/**
|
|
431
|
+
* The api.json for this file.
|
|
432
|
+
* if this file did not define any components, then this will be undefined.
|
|
433
|
+
*/
|
|
434
|
+
readonly apiModule?: ApiModule;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
/** @deprecated */
|
|
438
|
+
export interface ApiJsonOptions {
|
|
439
|
+
/**
|
|
440
|
+
* @deprecated Create "api-extractor.config.ts" and use `afterCreate` instead. [Example config](https://webgis.esri.com/references/api-extractor/tags-reference#copydoc)).
|
|
441
|
+
* @param api
|
|
442
|
+
* @param isPatchOnly
|
|
443
|
+
*/
|
|
444
|
+
afterCreate?(api: ApiJson, isPatchOnly: boolean): void;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
export interface CssHandlingOptions {
|
|
448
|
+
/**
|
|
449
|
+
* Path to a styles file that you wish to be applied to the entire page, even
|
|
450
|
+
* outside the shadow dom. Useful for declaring CSS variables.
|
|
451
|
+
*
|
|
452
|
+
* These styles will be applied automatically in the CDN build, thus users
|
|
453
|
+
* do not need a separate `<link>` tag. In the NPM build, users will need to
|
|
454
|
+
* manually apply these styles as appropriate in their bundler (either via
|
|
455
|
+
* import statement, or via `<link>` tag or etc).
|
|
456
|
+
*
|
|
457
|
+
* @example
|
|
458
|
+
* // If relative path is provided, it is relative to the root directory.
|
|
459
|
+
* "./src/styles/global.css"
|
|
460
|
+
*/
|
|
461
|
+
readonly globalStylesPath?: string;
|
|
462
|
+
/**
|
|
463
|
+
* Styles that you wish to make available in each component's shadow root, but
|
|
464
|
+
* to not apply outside the shadow root.
|
|
465
|
+
*
|
|
466
|
+
* These styles do no apply to non-shadow-root components.
|
|
467
|
+
*
|
|
468
|
+
* If you are using SCSS, you can also use the following Vite config option to
|
|
469
|
+
* add a common SCSS import to every SCSS file:
|
|
470
|
+
* ```tsx
|
|
471
|
+
* css: {
|
|
472
|
+
* preprocessorOptions: {
|
|
473
|
+
* scss: {
|
|
474
|
+
* // Add "includes.scss" import to each scss file
|
|
475
|
+
* additionalData(code, id) {
|
|
476
|
+
* const commonCss = "/src/assets/styles/includes";
|
|
477
|
+
* if (!id.endsWith(".scss") || id.endsWith(`${commonCss}.sass`)) {
|
|
478
|
+
* return undefined;
|
|
479
|
+
* }
|
|
480
|
+
* return `@import "${commonCss}";\n${code}`;
|
|
481
|
+
* },
|
|
482
|
+
* },
|
|
483
|
+
* },
|
|
484
|
+
* }
|
|
485
|
+
* ```
|
|
486
|
+
*/
|
|
487
|
+
readonly commonStylesPath?: string;
|
|
488
|
+
/**
|
|
489
|
+
* The attribute that indicates a component has rendered it's content.
|
|
490
|
+
* Usually this attribute is added after your component's `loaded()` lifecycle
|
|
491
|
+
* happened. However, during SSR, "hydrated" is added right away on the
|
|
492
|
+
* server.
|
|
493
|
+
*
|
|
494
|
+
* Until element has this attribute, it will have `visibility:hidden` style
|
|
495
|
+
* applied.
|
|
496
|
+
*
|
|
497
|
+
* @default "hydrated"
|
|
498
|
+
*/
|
|
499
|
+
readonly hydratedAttribute?: string;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
export interface AssetHandlingOptions {
|
|
503
|
+
/**
|
|
504
|
+
* Any additional assets you wish to provide, besides those located in the
|
|
505
|
+
* assets/ directories.
|
|
506
|
+
*
|
|
507
|
+
* @example
|
|
508
|
+
* ```ts
|
|
509
|
+
* import resolvePkg from "resolve-pkg";
|
|
510
|
+
*
|
|
511
|
+
* // ...
|
|
512
|
+
*
|
|
513
|
+
* extra: [
|
|
514
|
+
* {
|
|
515
|
+
* type: "directory",
|
|
516
|
+
* source: resolvePkg("@arcgis/arcade-sdk/dist/arcgis-arcade-editor")!,
|
|
517
|
+
* destination: "arcade-language",
|
|
518
|
+
* },
|
|
519
|
+
* ]
|
|
520
|
+
* ```
|
|
521
|
+
* @example
|
|
522
|
+
* If you need additional flexibility, you can call the
|
|
523
|
+
* `compilerContext.provideAssets()` utility at any time
|
|
524
|
+
*
|
|
525
|
+
* ```ts
|
|
526
|
+
* // vite.config.ts
|
|
527
|
+
* import { defineConfig } from "vite";
|
|
528
|
+
* import { useLumina } from "@arcgis/lumina-compiler";
|
|
529
|
+
*
|
|
530
|
+
* export default defineConfig((env) => {
|
|
531
|
+
* const lumina = useLumina();
|
|
532
|
+
*
|
|
533
|
+
* lumina.context.provideAssets([
|
|
534
|
+
* {
|
|
535
|
+
* type: "dynamic",
|
|
536
|
+
* source: () => new Date().toString(),
|
|
537
|
+
* destination: "build_date.txt",
|
|
538
|
+
* },
|
|
539
|
+
* ]);
|
|
540
|
+
*
|
|
541
|
+
* return {
|
|
542
|
+
* plugins: [lumina],
|
|
543
|
+
* };
|
|
544
|
+
* });
|
|
545
|
+
* ```
|
|
546
|
+
*/
|
|
547
|
+
readonly extra?: (AssetSpec | ProvideAssetsOptions)[];
|
|
548
|
+
/**
|
|
549
|
+
* The default asset path to use in NPM and CDN builds.
|
|
550
|
+
*
|
|
551
|
+
* @default require("@arcgis/lumina-compiler").inferCdnUrl()
|
|
552
|
+
*/
|
|
553
|
+
readonly defaultPath?: string;
|
|
554
|
+
/**
|
|
555
|
+
* Asset transformers to apply to assets in the assets/ directories in each
|
|
556
|
+
* component and to the assets/ directory in the package root.
|
|
557
|
+
*
|
|
558
|
+
* @example
|
|
559
|
+
* Example use cases:
|
|
560
|
+
* - minify the assets in production builds
|
|
561
|
+
* - transform the asset files
|
|
562
|
+
* - throw errors if detected incorrect assets
|
|
563
|
+
*/
|
|
564
|
+
readonly transformers?: AssetTransformer[];
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
/**
|
|
568
|
+
* Provide additional assets to be copied to the output directory during build
|
|
569
|
+
* or served during development.
|
|
570
|
+
*/
|
|
571
|
+
export interface ProvideAssetsOptions {
|
|
572
|
+
readonly assets: AssetSpec[];
|
|
573
|
+
readonly transformers?: AssetTransformer[];
|
|
574
|
+
/**
|
|
575
|
+
* By default, provided assets are available both to the dev server and are
|
|
576
|
+
* written to dist/
|
|
577
|
+
* You can optionally configure to only apply the assets to the dev server or
|
|
578
|
+
* only to the build.
|
|
579
|
+
*/
|
|
580
|
+
readonly apply?: CompilerContext["viteCommand"];
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
export type AssetSpec = AssetDirectory | AssetDynamic | AssetFile;
|
|
584
|
+
|
|
585
|
+
export interface AssetDirectory {
|
|
586
|
+
readonly type: "directory";
|
|
587
|
+
/** @example src/components/root/assets */
|
|
588
|
+
readonly source: string;
|
|
589
|
+
/**
|
|
590
|
+
* Base directory is /dist/cdn-folder-name/assets
|
|
591
|
+
*
|
|
592
|
+
* @example /root
|
|
593
|
+
* @example ../some-folder-outside-assets-dir/
|
|
594
|
+
*/
|
|
595
|
+
readonly destination: string;
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
export interface AssetFile {
|
|
599
|
+
readonly type: "file";
|
|
600
|
+
/** @example docs.json */
|
|
601
|
+
readonly source: string;
|
|
602
|
+
/**
|
|
603
|
+
* Base directory is /dist/cdn-folder-name/assets
|
|
604
|
+
*
|
|
605
|
+
* @example docs.json
|
|
606
|
+
*/
|
|
607
|
+
readonly destination: string;
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
export interface AssetDynamic {
|
|
611
|
+
readonly type: "dynamic";
|
|
612
|
+
/** @example () => new Date().toString() */
|
|
613
|
+
source(): Promise<string> | string;
|
|
614
|
+
readonly destination: string;
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
/**
|
|
618
|
+
* Transform static assets before serving then in development or before writing
|
|
619
|
+
* them to dist/ in production.
|
|
620
|
+
* Example use case: minifying JSON files, compressing SVGs, compressing images.
|
|
621
|
+
*
|
|
622
|
+
* Both in build and serve mode, the destination will be an absolute path to a
|
|
623
|
+
* file in the dist/ directory. The path will use POSIX path separators.
|
|
624
|
+
*/
|
|
625
|
+
export interface AssetTransformer {
|
|
626
|
+
/**
|
|
627
|
+
* @param destination
|
|
628
|
+
* @param context
|
|
629
|
+
*/
|
|
630
|
+
match(destination: string, context: CompilerContext): boolean;
|
|
631
|
+
/**
|
|
632
|
+
* Assuming for now that transformer will transform text files only.
|
|
633
|
+
* Also, for now only the first matching transformer will be used.
|
|
634
|
+
*
|
|
635
|
+
* @param fileContent
|
|
636
|
+
* @param destination
|
|
637
|
+
* @param context
|
|
638
|
+
*/
|
|
639
|
+
transform(fileContent: string, destination: string, context: CompilerContext): string;
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
export interface LintingOptions {
|
|
643
|
+
/**
|
|
644
|
+
* Lumina includes build-time checks for common issues and possible bugs.
|
|
645
|
+
* Most of those should be immediately addressable. However, some (like
|
|
646
|
+
* updating default value for boolean properties) may require a breaking
|
|
647
|
+
* change.
|
|
648
|
+
*
|
|
649
|
+
* This option exists to temporarily turn these errors into warnings.
|
|
650
|
+
*
|
|
651
|
+
* @example
|
|
652
|
+
* To silence an error in a file, add an entry like the following with the
|
|
653
|
+
* relative path to the file:
|
|
654
|
+
*
|
|
655
|
+
* ```ts
|
|
656
|
+
* booleanMustDefaultFalse: ["src/components/counter/counter.tsx"]
|
|
657
|
+
* ```
|
|
658
|
+
*/
|
|
659
|
+
readonly silence: LintingSilenceOptions;
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
export interface LintingSilenceOptions {
|
|
663
|
+
/**
|
|
664
|
+
* Lumina components may declare required properties using `@required` JSDoc
|
|
665
|
+
* tag.
|
|
666
|
+
*
|
|
667
|
+
* Required properties are enforced in public TypeScript typings. However,
|
|
668
|
+
* they are not enforced by TypeScript within the package itself due to
|
|
669
|
+
* technical limitations. Instead, this rule exists to enforce them at
|
|
670
|
+
* build-time.
|
|
671
|
+
*
|
|
672
|
+
* [Documentation](https://webgis.esri.com/references/lumina/properties#string-properties)
|
|
673
|
+
*/
|
|
674
|
+
mustIncludeAllRequiredProperties?: string[];
|
|
675
|
+
}
|