@arcgis/lumina-compiler 5.2.0-next.7 → 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.
- 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 +11 -7
- 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
package/dist/context/index.d.ts
CHANGED
|
@@ -1,296 +1,158 @@
|
|
|
1
|
-
import { ConfigEnv
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
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
|
+
}
|
package/dist/context/types.d.ts
CHANGED
|
@@ -1,34 +1,18 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
|
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
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
|
|
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 {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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>;
|