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