@arcgis/lumina-compiler 5.2.0-next.8 → 5.2.0-next.9

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 +11 -7
  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,296 +1,158 @@
1
- import { ConfigEnv, Plugin, ResolvedConfig, ViteDevServer } from 'vite';
2
- import { default as ts } from 'typescript';
3
- import { ApiCustomElementDeclaration, ApiJson } from '@arcgis/api-extractor/apiJson';
4
- import { LuminaOptions, AssetSpec, AssetTransformer, ProvideAssetsOptions, LintingOptions } from '../publicTypes.ts';
5
- import { DocsType } from '../docs/types.ts';
6
- import { ContextDirectories } from './types.ts';
7
- import { makeLoaders, computeServeOnlyDependencies } from '../dependencies/loaders.ts';
8
- import { CustomElementInterdependencies } from '../entrypoints/config.ts';
9
- import { getLocalDefinedComponentsFromApiJson } from '../entrypoints/resolveTagName.ts';
10
- import { unsafeGetUndocumentedPrinter } from '@arcgis/api-extractor/utils/internalTypeScriptApis';
11
- import { ApiExtractor } from '@arcgis/api-extractor/extractor/ApiExtractor';
12
- import { ApiExtractorPluginConfig } from '@arcgis/api-extractor/vite/plugin';
13
- /**
14
- * A compiler state and context object that is shared across plugins.
15
- */
16
- export declare class CompilerContext {
17
- /**
18
- * TypeScript source file instances created in serve mode
19
- *
20
- * @private
21
- */
22
- private readonly _typeScriptSourceFiles;
23
- /**
24
- * A promise for after tsconfig.json and api-extractor.config.ts are loaded
25
- * and list of files in current project are resolved.
26
- *
27
- * @private
28
- */
29
- configsPromise: Promise<void>;
30
- /**
31
- * Whether minification is enabled for transformed JSX (lit-html templates)
32
- * and generated component code.
33
- */
34
- shouldMinify: boolean;
35
- /**
36
- * Like this.shouldMinify, but true when in test mode. Reasons:
37
- * - If accessing .textContent, the whitespace amount differs between minified
38
- * and non-minified lit-html templates. In Stencil's JSX this was not the
39
- * case. To ease migration of tests, we minify lit-html in tests too.
40
- * - From the above, you can see that minification does change semantics in
41
- * some cases. To have tests be truer to the real world, we minify in tests.
42
- *
43
- * Also, true during build as per
44
- * https://devtopia.esri.com/WebGIS/arcgis-web-components/issues/2084
45
- */
46
- shouldMinifyJsx: boolean;
47
- /**
48
- *
49
- * A vite plugin that sets the initial context information based on Vite
50
- * environment
51
- *
52
- * @private
53
- */
54
- readonly _plugin: Plugin;
55
- /**
56
- * List of directories of common interest to the compiler
57
- */
58
- dir: ContextDirectories;
59
- apiExtractor: ApiExtractor | undefined;
60
- /**
61
- * @private
62
- */
63
- apiExtractorPluginConfig: ApiExtractorPluginConfig;
64
- /**
65
- * The api.json stores information about the structure of all components in
66
- * the package (their properties, methods, events, JSDoc and etc).
67
- *
68
- * You can augment the api.json generation using the `apiJson` option in
69
- * `useLumina()`
70
- */
71
- apiJson: ApiJson;
72
- /**
73
- * A flattened api.json listing all components in this package.
74
- */
75
- apiJsonComponents: ApiCustomElementDeclaration[];
76
- /**
77
- * Like this.apiJson, but also contains members decorated with the `@private`
78
- * JSDoc tag.
79
- */
80
- privateApiJson: ApiJson;
81
- /**
82
- * Resolves once api.json is first generated during a given build run.
83
- * @private
84
- */
85
- apiJsonDeferred: PromiseWithResolvers<void> | undefined;
86
- /**
87
- * In some test environments, api.json will never be produced.
88
- */
89
- apiJsonEnabled: boolean;
90
- /**
91
- * Cached result of getLocalDefinedComponentsFromApiJson() call
92
- *
93
- * @private
94
- */
95
- _localDefinedComponents?: ReturnType<typeof getLocalDefinedComponentsFromApiJson>;
96
- /**
97
- * The environment that Vite is running in
98
- *
99
- * By default, `npx vite` will run in `development` mode. and `npx vite build`
100
- * will run in `production` mode. However, you can do a development-mode build
101
- * using `npx vite build --mode development`
102
- *
103
- * - By default, source maps are generated only in development builds.
104
- * - Minification happens in production builds.
105
- */
106
- environment: "development" | "production";
107
- /**
108
- * It is a best practice to keep local build behavior as similar as possible
109
- * to CI build. Thus, only use this option if some behavior really
110
- * needs to be different in the CI.
111
- *
112
- * For example, `@arcgis/lumina-compiler` will by default automatically update
113
- * your package's package.json if it is missing some properties. However, this
114
- * behavior is disabled on the CI machine.
115
- *
116
- * @default Boolean(process.env.CI)
117
- */
118
- readonly isInCi: boolean;
119
- /**
120
- * It is a best practice to keep production behavior as similar as possible
121
- * to test environment. Thus, only use this option if some behavior really
122
- * needs to be different in test environment.
123
- *
124
- * For example, `@arcgis/lumina-compiler` will by default automatically update
125
- * your package's package.json if it is missing some properties. However, this
126
- * behavior is disabled in test environment.
127
- *
128
- * Test environment is detected in the following cases:
129
- * - Running in test mode (`npx vite build --mode test`). In such case
130
- * CompilerContext.environment will still be set to `development`
131
- * - Running in vitest - a test runner for Vite (`npx vitest`)
132
- * - Running vitest performance benchmark (`npx vitest benchmark`)
133
- */
134
- isInTest: boolean;
135
- /**
136
- * If running inside of Vitest as part of Puppeteer test integration
137
- */
138
- isInPuppeteerTestBackEnd: boolean;
139
- /**
140
- * If running in a Vite instance created by Vitest Puppeteer integration.
141
- */
142
- isInPuppeteerTestFrontEnd: boolean;
143
- isInBuildWatch: boolean;
144
- /**
145
- * Whether Vite build/serve is running inside of Storybook.
146
- */
147
- isInStorybook: boolean;
148
- /**
149
- * Whether HMR is enabled during the current Vite run
150
- */
151
- hmrEnabled: boolean;
152
- /**
153
- * Vite can be run in two modes:
154
- * - Serve the project (with watching for changes and hot module reloading).
155
- * This is the case when you run Vite as `npx vite`
156
- * - Build the project (with bundling and optimizations).
157
- * This is the case when you run Vite as `npx vite build`
158
- *
159
- * `@arcgis/lumina-compiler` does not know what environment Vite is running
160
- * in until the `apply()` Vite plugin hook is called by Vite. That means, you
161
- * should not try to read this property before the `apply()` hook is called.
162
- */
163
- viteCommand: ConfigEnv["command"];
164
- /**
165
- * Whether to extract full API information, with type-checking. This is the
166
- * case during build or when running under Storybook. Otherwise, the dev
167
- * server keeps API extraction to bare minimum to reduce needless overhead.
168
- * Only the information necessary for the dev server to lazy load is
169
- * extracted.
170
- */
171
- isFullApiExtraction: boolean;
172
- readonly banner: string;
173
- /**
174
- * Options passed to `useLumina()`
175
- */
176
- readonly options: LuminaOptions;
177
- /**
178
- * Resolved file names for documentation files
179
- *
180
- * @private
181
- */
182
- readonly _documentationFileNames: Record<DocsType, string | undefined>;
183
- /**
184
- * Resolved Vite configuration
185
- */
186
- viteConfig: ResolvedConfig;
187
- /**
188
- * Vite's dev server. Set only if Vite is running in serve mode
189
- */
190
- server: ViteDevServer;
191
- /**
192
- * Whether configServer() hook has already been called
193
- *
194
- * @private
195
- */
196
- _serverConfigured: boolean;
197
- /**
198
- * Assets pending to be served
199
- *
200
- * @private
201
- */
202
- assetsToProvide: ProvideAssetsOptions[] | undefined;
203
- /**
204
- * A promise that resolves to list of file names that declare one or more
205
- * components. This promise only represents the initial scan and is not updated
206
- * in watch or serve mode.
207
- */
208
- componentFilesPromise: Promise<string[]>;
209
- /**
210
- * Style for hiding custom elements before they are loaded. This is appended
211
- * to the global stylesheet.
212
- *
213
- * @private
214
- */
215
- _globalHydratedCssString: string;
216
- /**
217
- * Contents of the bundled global CSS file. The string is JSON-encoded so that
218
- * it can be injected into a JavaScript file as a string literal.
219
- *
220
- * @private
221
- */
222
- _globalCssString?: string;
223
- /**
224
- * Cached result of makeLoaders() call
225
- *
226
- * @private
227
- */
228
- _loadersCache?: ReturnType<typeof makeLoaders>;
229
- /**
230
- * Cached result of computeServeOnlyDependencies() call
231
- *
232
- * @private
233
- */
234
- _serveOnlyDependencies?: ReturnType<typeof computeServeOnlyDependencies>;
235
- /**
236
- * Data structure that stores references between class components and between
237
- * functional components.
238
- * This is used in build mode only.
239
- *
240
- * @private
241
- */
242
- _customElementDependencies: CustomElementInterdependencies;
243
- /**
244
- * Cached result of getPrinter() call. Cached to not needlessly create and
245
- * throw away a printer instance for each transformed file.
246
- *
247
- * @private
248
- */
249
- _typeScriptPrinter: ReturnType<typeof unsafeGetUndocumentedPrinter>;
250
- private _silencedRules;
251
- /**
252
- * Promise that resolves once src/lumina.ts is updated
253
- * @private
254
- */
255
- _updateLuminaTsPromise?: Promise<void>;
256
- /** @private */
257
- _originalRollupInputOptions?: Record<string, string> | undefined;
258
- constructor(options: LuminaOptions);
259
- private _inferBuildSetup;
260
- /**
261
- * Get TypeScript ts.SourceFile based on file name and code. Reuses existing
262
- * source file instance if already created one for that file, and code has not
263
- * changed.
264
- */
265
- getSourceFile(fileName: string, code: string): ts.SourceFile;
266
- /**
267
- * A utility for making Vite copy assets to the output folder during build or
268
- * making Vite serve them when running in serve mode
269
- *
270
- * @example
271
- * ```ts
272
- * // vite.config.ts
273
- * import { defineConfig } from "vite";
274
- * import { useLumina } from "@arcgis/lumina-compiler";
275
- *
276
- * export default defineConfig((env) => {
277
- * const lumina = useLumina();
278
- *
279
- * lumina.context.provideAssets([
280
- * {
281
- * type: "dynamic",
282
- * source: () => new Date().toString(),
283
- * destination: "build_date.txt",
284
- * },
285
- * ]);
286
- *
287
- * return {
288
- * plugins: [lumina],
289
- * };
290
- * });
291
- * ```
292
- */
293
- provideAssets(assets: AssetSpec[], transformers?: AssetTransformer[], apply?: CompilerContext["viteCommand"]): void;
294
- logLintWarning(error: string): void;
295
- logLintError(rule: keyof LintingOptions["silence"], absoluteFilePath: string, error: string): void;
296
- }
1
+ import type { ConfigEnv } from "vite";
2
+ import type { ApiCustomElementDeclaration, ApiJson } from "@arcgis/api-extractor/apiJson";
3
+ import type { LuminaOptions, AssetSpec, AssetTransformer } from "../options.js";
4
+ import type { ContextDirectories } from "./types.js";
5
+ import type { ApiExtractor } from "@arcgis/api-extractor/extractor/ApiExtractor";
6
+
7
+ /** A compiler state and context object that is shared across plugins. */
8
+ export abstract class CompilerContext {
9
+ apiExtractor?: ApiExtractor;
10
+ /**
11
+ * The api.json stores information about the structure of all components in
12
+ * the package (their properties, methods, events, JSDoc and etc).
13
+ *
14
+ * You can augment the api.json generation using the `apiJson` option in
15
+ * `useLumina()`
16
+ */
17
+ apiJson: ApiJson;
18
+ /** A flattened api.json listing all components in this package. */
19
+ apiJsonComponents: ApiCustomElementDeclaration[];
20
+ /** In some test environments, api.json will never be produced. */
21
+ apiJsonEnabled: boolean;
22
+ /** List of directories of common interest to the compiler */
23
+ dir: ContextDirectories;
24
+ /**
25
+ * The environment that Vite is running in
26
+ *
27
+ * By default, `npx vite` will run in `development` mode. and `npx vite build`
28
+ * will run in `production` mode. However, you can do a development-mode build
29
+ * using `npx vite build --mode development`
30
+ *
31
+ * - By default, source maps are generated only in development builds.
32
+ * - Minification happens in production builds.
33
+ */
34
+ environment: "development" | "production";
35
+ /** Whether HMR is enabled during the current Vite run */
36
+ hmrEnabled: boolean;
37
+ /**
38
+ * Whether to extract full API information, with type-checking. This is the
39
+ * case during build or when running under Storybook. Otherwise, the dev
40
+ * server keeps API extraction to bare minimum to reduce needless overhead.
41
+ * Only the information necessary for the dev server to lazy load is
42
+ * extracted.
43
+ */
44
+ isFullApiExtraction: boolean;
45
+ /** True in `vite build --watch` mode. */
46
+ isInBuildWatch: boolean;
47
+ /**
48
+ * It is a best practice to keep local build behavior as similar as possible
49
+ * to CI build. Thus, only use this option if some behavior really
50
+ * needs to be different in the CI.
51
+ *
52
+ * For example, `@arcgis/lumina-compiler` will by default automatically update
53
+ * your package's package.json if it is missing some properties. However, this
54
+ * behavior is disabled on the CI machine.
55
+ *
56
+ * @default Boolean(process.env.CI)
57
+ */
58
+ readonly isInCi: boolean;
59
+ /**
60
+ * If running inside of Vitest as part of Puppeteer test integration
61
+ *
62
+ * @deprecated
63
+ * For new projects, use Vitest browser mode instead of Puppeteer.
64
+ * See documentation: https://webgis.esri.com/references/lumina/testing
65
+ */
66
+ isInPuppeteerTestBackEnd: boolean;
67
+ /** If running in a Vite instance created by Vitest Puppeteer integration. */
68
+ isInPuppeteerTestFrontEnd: boolean;
69
+ /** Whether Vite build/serve is running inside of Storybook. */
70
+ isInStorybook: boolean;
71
+ /**
72
+ * It is a best practice to keep production behavior as similar as possible
73
+ * to test environment. Thus, only use this option if some behavior really
74
+ * needs to be different in test environment.
75
+ *
76
+ * For example, `@arcgis/lumina-compiler` will by default automatically update
77
+ * your package's package.json if it is missing some properties. However, this
78
+ * behavior is disabled in test environment.
79
+ *
80
+ * Test environment is detected in the following cases:
81
+ * - Running in test mode (`npx vite build --mode test`). In such case
82
+ * CompilerContext.environment will still be set to `development`
83
+ * - Running in vitest - a test runner for Vite (`npx vitest`)
84
+ * - Running vitest performance benchmark (`npx vitest benchmark`)
85
+ */
86
+ isInTest: boolean;
87
+ /** Options passed to `useLumina()` */
88
+ readonly options: LuminaOptions;
89
+ /**
90
+ * Like this.apiJson, but also contains members decorated with the `@private`
91
+ * JSDoc tag.
92
+ */
93
+ privateApiJson: ApiJson;
94
+ /**
95
+ * Whether minification is enabled for transformed JSX (lit-html templates)
96
+ * and generated component code.
97
+ *
98
+ * @internal
99
+ */
100
+ shouldMinify: boolean;
101
+ /**
102
+ * Like this.shouldMinify, but true when in test mode. Reasons:
103
+ * - If accessing .textContent, the whitespace amount differs between minified
104
+ * and non-minified lit-html templates. In Stencil's JSX this was not the
105
+ * case. To ease migration of tests, we minify lit-html in tests too.
106
+ * - From the above, you can see that minification does change semantics in
107
+ * some cases. To have tests be truer to the real world, we minify in tests.
108
+ *
109
+ * Also, true during build as per
110
+ * https://devtopia.esri.com/WebGIS/arcgis-web-components/issues/2084
111
+ *
112
+ * @internal
113
+ */
114
+ shouldMinifyJsx: boolean;
115
+ /**
116
+ * Vite can be run in two modes:
117
+ * - Serve the project (with watching for changes and hot module reloading).
118
+ * This is the case when you run Vite as `npx vite`
119
+ * - Build the project (with bundling and optimizations).
120
+ * This is the case when you run Vite as `npx vite build`
121
+ *
122
+ * `@arcgis/lumina-compiler` does not know what environment Vite is running
123
+ * in until the `apply()` Vite plugin hook is called by Vite. That means, you
124
+ * should not try to read this property before the `apply()` hook is called.
125
+ */
126
+ viteCommand: ConfigEnv["command"];
127
+ /**
128
+ * A utility for making Vite copy assets to the output folder during build or
129
+ * making Vite serve them when running in serve mode
130
+ *
131
+ * @param assets
132
+ * @param transformers
133
+ * @param apply
134
+ * @example
135
+ * ```ts
136
+ * // vite.config.ts
137
+ * import { defineConfig } from "vite";
138
+ * import { useLumina } from "@arcgis/lumina-compiler";
139
+ *
140
+ * export default defineConfig((env) => {
141
+ * const lumina = useLumina();
142
+ *
143
+ * lumina.context.provideAssets([
144
+ * {
145
+ * type: "dynamic",
146
+ * source: () => new Date().toString(),
147
+ * destination: "build_date.txt",
148
+ * },
149
+ * ]);
150
+ *
151
+ * return {
152
+ * plugins: [lumina],
153
+ * };
154
+ * });
155
+ * ```
156
+ */
157
+ provideAssets(assets: AssetSpec[], transformers?: AssetTransformer[], apply?: CompilerContext["viteCommand"]): void;
158
+ }
@@ -1,34 +1,18 @@
1
- export type ContextDirectories = {
2
- /**
3
- * The project root directory. Usually equals to process.cwd() + '/'
4
- */
5
- root: string;
6
- /**
7
- * The source directory. Usually equals dir.root + `src/`
8
- */
9
- src: string;
10
- /**
11
- * The components directory. Usually equals dir.src + `components/`
12
- */
13
- srcComponents: string;
14
- /**
15
- * The root-relative path to the dist directory. Usually 'dist/'
16
- */
17
- relativeDist: string;
18
- /**
19
- * The output directory. Usually equals dir.root + `dist/`
20
- */
21
- dist: string;
22
- /**
23
- * The CDN output directory. Usually equals dir.output + `cdn/`
24
- */
25
- distCdn: string;
26
- /**
27
- * The components output directory. Usually equals dir.output + `components/`
28
- */
29
- distComponents: string;
30
- /**
31
- * The assets output directory. Usually equals dir.output + `cdn/assets/`
32
- */
33
- distCdnAssets: string;
34
- };
1
+ export interface ContextDirectories {
2
+ /** The project root directory. Usually equals to process.cwd() + '/' */
3
+ root: string;
4
+ /** The source directory. Usually equals dir.root + `src/` */
5
+ src: string;
6
+ /** The components directory. Usually equals dir.src + `components/` */
7
+ srcComponents: string;
8
+ /** The root-relative path to the dist directory. Usually 'dist/' */
9
+ relativeDist: string;
10
+ /** The output directory. Usually equals dir.root + `dist/` */
11
+ dist: string;
12
+ /** The CDN output directory. Usually equals dir.output + `cdn/` */
13
+ distCdn: string;
14
+ /** The components output directory. Usually equals dir.output + `components/` */
15
+ distComponents: string;
16
+ /** The assets output directory. Usually equals dir.output + `cdn/assets/` */
17
+ distCdnAssets: string;
18
+ }
@@ -2,14 +2,14 @@
2
2
  * Generates a URL like this from the provided package json:
3
3
  * `https://js.arcgis.com/<simplified-package-name>/<released-verion>/`
4
4
  *
5
- * @example
6
- * `https://js.arcgis.com/map-components/4.30/`
7
- *
8
- * @remarks
9
5
  * If package version number includes "next", `jsdev.arcgis.com` CDN is used
10
6
  * instead of `js.arcgis.com`.
7
+ *
8
+ * @param packageJson
9
+ * @param preferNext
10
+ * @example `https://js.arcgis.com/map-components/4.30/`
11
11
  */
12
- export declare function inferCdnUrl(packageJson?: {
12
+ export function inferCdnUrl(packageJson?: {
13
13
  name: string;
14
14
  version: string;
15
- }, preferNext?: boolean): string;
15
+ }, preferNext?: boolean): string;
@@ -1,26 +1,41 @@
1
- import { PackageJson } from '@arcgis/components-build-utils';
2
- import { ApiJson } from '@arcgis/api-extractor/apiJson';
3
- import { LuminaOptions } from '../publicTypes.ts';
4
- export type ResolvedDependencyComponents = {
5
- readonly packageName: string;
6
- readonly type: "@arcgis/lumina" | "stencil" | "unknown";
7
- readonly components: Readonly<Record<string, ResolvedDependencyComponent>>;
8
- readonly cdnUrl?: string;
9
- readonly packageLocation: string;
10
- readonly packageJson: PackageJson;
11
- };
12
- export type ResolvedDependencyComponent = {
13
- modulePath: string;
14
- packageName: string | undefined;
15
- /**
16
- * If jsx property has a static value, and we see that an equivalent attribute
17
- * exists, jsx property will be converted to an attribute rather than
18
- * property. If we failed to read all attributes from a package, it's not a
19
- * big deal as we will then play safe and leave jsx properties as properties.
20
- */
21
- readonly propToAttribute: Readonly<Record<string, string>>;
22
- requiredProperties?: Set<string>;
23
- };
1
+ import type { PackageJson } from "@arcgis/components-build-utils";
2
+ import type { LuminaOptions } from "../options.js";
3
+
4
+ /** @internal */
5
+ export interface ResolvedDependencyComponents {
6
+ /** @internal */
7
+ readonly packageName: string;
8
+ /** @internal */
9
+ readonly type: "@arcgis/lumina" | "stencil" | "unknown";
10
+ /** @internal */
11
+ readonly components: Readonly<Record<string, ResolvedDependencyComponent>>;
12
+ /** @internal */
13
+ readonly cdnUrl?: string;
14
+ /** @internal */
15
+ readonly packageLocation: string;
16
+ /** @internal */
17
+ readonly packageJson: PackageJson;
18
+ }
19
+
20
+ /** @internal */
21
+ export interface ResolvedDependencyComponent {
22
+ /** @internal */
23
+ readonly modulePath: string;
24
+ /** @internal */
25
+ readonly packageName?: string;
26
+ /**
27
+ * If jsx property has a static value, and we see that an equivalent attribute
28
+ * exists, jsx property will be converted to an attribute rather than
29
+ * property. If we failed to read all attributes from a package, it's not a
30
+ * big deal as we will then play safe and leave jsx properties as properties.
31
+ *
32
+ * @internal
33
+ */
34
+ readonly propToAttribute: Readonly<Record<string, string>>;
35
+ /** @internal */
36
+ requiredProperties?: ReadonlySet<string>;
37
+ }
38
+
24
39
  /**
25
40
  * Read information about our web component dependencies. This will be used to:
26
41
  * - know where to auto-import a component from
@@ -49,16 +64,9 @@ export type ResolvedDependencyComponent = {
49
64
  *
50
65
  * If this does not work for one of your dependencies, provide a custom resolver
51
66
  * to autoAddImports() or useLumina().
67
+ *
68
+ * @param cwd
69
+ * @param options
70
+ * @internal
52
71
  */
53
- export declare function initializeComponentDependencies(cwd?: string, options?: LuminaOptions): Promise<readonly ResolvedDependencyComponents[]>;
54
- export declare function retrieveComponentDependencies(): readonly ResolvedDependencyComponents[];
55
- export declare function retrieveFlatComponentDependencies(): ResolvedDependencyComponents["components"];
56
- export declare let componentDependenciesPromise: Promise<readonly ResolvedDependencyComponents[]> | undefined;
57
- export declare function findPackageComponents(packageName: string, cwd?: string): Promise<ResolvedDependencyComponents | undefined>;
58
- /**
59
- * Given the custom element manifest, find custom elements defined in it
60
- */
61
- export declare function manifestToDependencyComponents(manifest: Partial<ApiJson>, dependency: {
62
- readonly packageName: string | undefined;
63
- readonly getImportPath: (tagName: string) => string;
64
- }, computeRequiredProperties?: boolean): ResolvedDependencyComponents["components"];
72
+ export function initializeComponentDependencies(cwd?: string, options?: LuminaOptions): Promise<readonly ResolvedDependencyComponents[]>;
@@ -1,11 +1,10 @@
1
- import { ResolvedDependencyComponents } from './discover.ts';
2
- export declare function updateLuminaTs(dependencies: readonly ResolvedDependencyComponents[], srcDir: string,
3
- /** Preserved positional argument for compatibility because codemod was passing it */
4
- _unused?: never,
5
- /** Preserved positional argument for compatibility because codemod was passing it */
6
- _unused2?: never, packageJson?: import('@arcgis/components-build-utils').PackageJson): Promise<boolean>;
7
- declare function produceLuminaTs(dependencies: readonly ResolvedDependencyComponents[], packageJson?: import('@arcgis/components-build-utils').PackageJson): string;
8
- export declare const exportsForTests: {
9
- produceLuminaTs: typeof produceLuminaTs;
10
- };
11
- export {};
1
+ import type { PackageJson } from "@arcgis/components-build-utils";
2
+ import type { ResolvedDependencyComponents } from "./discover.js";
3
+
4
+ /**
5
+ * @param dependencies
6
+ * @param srcDir
7
+ * @param packageJson
8
+ * @internal
9
+ */
10
+ export function updateLuminaTs(dependencies: readonly ResolvedDependencyComponents[], srcDir: string, packageJson?: PackageJson): Promise<boolean>;