@arcgis/lumina-compiler 4.34.0-next.13 → 4.34.0-next.131
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/LICENSE.md +1 -1
- package/README.md +2 -10
- package/dist/context/index.d.ts +3 -2
- package/dist/dependencies/arcgisCore.d.ts +1 -1
- package/dist/dependencies/discover.d.ts +5 -1
- package/dist/dependencies/lumina.d.ts +1 -1
- package/dist/dependencies/stencil.d.ts +2 -2
- package/dist/dependencies/updateLumina.d.ts +3 -3
- package/dist/entrypoints/resolveTagName.d.ts +1 -1
- package/dist/index.js +2252 -2238
- package/dist/jsxToLitHtml/importsConfig.d.ts +10 -0
- package/dist/jsxToLitHtml/types.d.ts +4 -2
- package/dist/loader/{hideUntilHydrated.d.ts → css.d.ts} +6 -1
- package/dist/logger-hJvg0JOj.js +34 -0
- package/dist/plugins/buildCdn.d.ts +6 -0
- package/dist/plugins/loadLitCss.d.ts +52 -11
- package/dist/publicTypes.d.ts +59 -114
- package/dist/puppeteerTesting/index.js +1 -1
- package/dist/puppeteerTesting/vitest/matchers/index.d.ts +12 -12
- package/dist/testing/failOnConsole.d.ts +6 -0
- package/dist/testing/index.js +79 -60
- package/dist/testing/mount.d.ts +2 -2
- package/dist/testing/vitestTypes.d.ts +8 -0
- package/dist/transformers/injectRuntimeOptions.d.ts +12 -2
- package/dist/transformers/internalTypeScriptApis.d.ts +4 -1
- package/dist/transformers/utils.d.ts +2 -7
- package/package.json +20 -18
- package/dist/jsxToLitHtml/escapeForTemplateLiteral.d.ts +0 -45
- package/dist/logger-KpGU2b3R.js +0 -28
- package/dist/plugins/buildStencilHydrate.d.ts +0 -16
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { JsxImportName } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Most Lit API's are re-exported from multiple packages. Because only Lit
|
|
4
|
+
* package is declared as an explicit dependency, Lumina's auto-inserted imports
|
|
5
|
+
* should only import from the Lit package (from the first import path in the
|
|
6
|
+
* lists below). However, to avoid double-importing things if the file already
|
|
7
|
+
* imports these APIs from another package, we need to check for all the places
|
|
8
|
+
* that export these APIs (the 2nd+ items in the lists below).
|
|
9
|
+
*/
|
|
10
|
+
export declare const dynamicallyInsertedImportsByName: Record<JsxImportName, string[]>;
|
|
@@ -63,10 +63,12 @@ export declare const ambiguousSvgTag: unique symbol;
|
|
|
63
63
|
export declare const cssTag = "css";
|
|
64
64
|
export declare const mathMlTag = "mathml";
|
|
65
65
|
declare const litTagsArray: readonly ["css", "html", "mathml", "staticHtml", "staticSvg", "svg"];
|
|
66
|
-
export declare const litTags: Set<"html" | "
|
|
66
|
+
export declare const litTags: Set<"html" | "svg" | "css" | "mathml" | "staticHtml" | "staticSvg">;
|
|
67
67
|
export type LitTag = (typeof litTagsArray)[number];
|
|
68
|
-
export declare const jsxImportNames: readonly ["keyed", "ref", "repeat", "live", "css", "html", "mathml", "staticHtml", "staticSvg", "svg", "safeClassMap", "safeStyleMap", "deferLoad", "nothing"];
|
|
68
|
+
export declare const jsxImportNames: readonly ["keyed", "ref", "repeat", "live", "css", "html", "mathml", "staticHtml", "staticSvg", "svg", "safeClassMap", "safeStyleMap", "deferLoad", "stabilizedRef", "nothing"];
|
|
69
69
|
export type JsxImportName = (typeof jsxImportNames)[number];
|
|
70
70
|
export type JsxHost = ts.JsxElement | ts.JsxFragment | ts.JsxSelfClosingElement;
|
|
71
|
+
/** Returns `true` if the given node is an array expression containing jsx nodes */
|
|
72
|
+
export declare const isJsxArray: (node: ts.Node) => node is ts.ArrayLiteralExpression;
|
|
71
73
|
export declare const isJsxHost: (node: ts.Node) => node is JsxHost;
|
|
72
74
|
export {};
|
|
@@ -9,7 +9,12 @@ export declare const defaultHydratedAttribute = "hydrated";
|
|
|
9
9
|
* @see https://discord.com/channels/1012791295170859069/1274527043614150708
|
|
10
10
|
*/
|
|
11
11
|
export declare function getGlobalCssInjectionCode(globalCssString: string | undefined, context: CompilerContext): string;
|
|
12
|
-
/**
|
|
12
|
+
/**a
|
|
13
13
|
* Get a CSS string that can be printed into a .css file
|
|
14
|
+
*
|
|
15
|
+
* Global CSS is auto-imported by bundlers. To ensure it is always loaded with
|
|
16
|
+
* lower precedence order than user styles, we wrap it in `@layer{}`.
|
|
17
|
+
*
|
|
18
|
+
* @see https://devtopia.esri.com/WebGIS/arcgis-web-components/discussions/1824#discussioncomment-12625
|
|
14
19
|
*/
|
|
15
20
|
export declare const getGlobalCssAsString: (context: CompilerContext) => string;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { setApiExtractorErrorLogger as c } from "@arcgis/api-extractor";
|
|
2
|
+
import { toSystemPathSeparators as i, path as g } from "@arcgis/components-build-utils";
|
|
3
|
+
import a from "chalk";
|
|
4
|
+
let e = {
|
|
5
|
+
// Temporary logger to use until vite config is loaded and we have access to
|
|
6
|
+
// actual logger.
|
|
7
|
+
info: console.log,
|
|
8
|
+
warn: console.warn,
|
|
9
|
+
error: console.error
|
|
10
|
+
}, s = process.cwd();
|
|
11
|
+
function n(t, r, o) {
|
|
12
|
+
return typeof o == "string" ? (o = o.startsWith(s) ? i(g.relative(s, o)) : o, o = `${o}: `) : o = "", `${t} ${o}${r}`;
|
|
13
|
+
}
|
|
14
|
+
const f = {
|
|
15
|
+
initialize(t, r) {
|
|
16
|
+
e = t, s = r, c(e.error);
|
|
17
|
+
},
|
|
18
|
+
info(t, r, o) {
|
|
19
|
+
e.info(n(a.cyan(`[${t}]`), r, o));
|
|
20
|
+
},
|
|
21
|
+
warn(t, r, o) {
|
|
22
|
+
e.warn(n(a.yellow(`[${t}]`), r, o));
|
|
23
|
+
},
|
|
24
|
+
error(t, r, o) {
|
|
25
|
+
e.error(n(a.red(`[${t}]`), r, o)), process.exitCode = 1;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
function l(t, r, o) {
|
|
29
|
+
return r instanceof Error ? (r.message = n(t, r.message, o), r) : n(a.red(`[${t}]`), r, o);
|
|
30
|
+
}
|
|
31
|
+
export {
|
|
32
|
+
l as f,
|
|
33
|
+
f as l
|
|
34
|
+
};
|
|
@@ -65,7 +65,13 @@ export declare function buildLoaderCode(runtimeVariableName: string, customEntry
|
|
|
65
65
|
* ```
|
|
66
66
|
*/
|
|
67
67
|
declare function transformChunk(chunk: CdnChunk, chunks: Map<string, CdnChunk>): void;
|
|
68
|
+
/**
|
|
69
|
+
* Given set of identifiers, produce the shortest possible ASCII-only identifier.
|
|
70
|
+
* We restrict to ASCII-range as it is faster to parse for engines.
|
|
71
|
+
*/
|
|
72
|
+
declare function createIdentifierGenerator(seen: Set<string>): () => string;
|
|
68
73
|
export declare const exportsForTests: {
|
|
69
74
|
transformChunk: typeof transformChunk;
|
|
75
|
+
createIdentifierGenerator: typeof createIdentifierGenerator;
|
|
70
76
|
};
|
|
71
77
|
export {};
|
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
import { Plugin } from 'vite';
|
|
2
2
|
import { CompilerContext } from '../context';
|
|
3
|
+
/**
|
|
4
|
+
* CSS extension list taken from https://github.com/vitejs/vite/blob/a8c7083a3d7d7fe2e83e994ff008f39ee4f298f8/packages/vite/src/node/constants.ts#L50
|
|
5
|
+
*/
|
|
3
6
|
export declare const cssLangsRe: RegExp;
|
|
7
|
+
/**
|
|
8
|
+
* A flag added by Lumina at compile time to named CSS imports to turn
|
|
9
|
+
* them into Lit css`` tagged template literals (using `styles` named import).
|
|
10
|
+
*
|
|
11
|
+
* We do not automatically process every CSS file to allow for both:
|
|
12
|
+
* - keeping side-effect CSS imports inside external library code as is
|
|
13
|
+
* - tricky to do using resolveId() because ESBuild is used for some files in
|
|
14
|
+
* dev server.
|
|
15
|
+
* - explicitly importing external library's CSS as Lit css into shadow root
|
|
16
|
+
* - example: monaco or ckeditor styles, but attached into shadow root, rather
|
|
17
|
+
* than global
|
|
18
|
+
*/
|
|
19
|
+
export declare const litCssFlag = "?litCss";
|
|
4
20
|
/**
|
|
5
21
|
* The `.adoptedStyleSheets` API is very convenient, but it has one issue: it
|
|
6
22
|
* has higher precedence order than the `<link>` or `<style>` tags. This API was
|
|
@@ -12,18 +28,42 @@ export declare const cssLangsRe: RegExp;
|
|
|
12
28
|
* More information:
|
|
13
29
|
* https://discord.com/channels/1012791295170859069/1274527043614150708
|
|
14
30
|
*/
|
|
15
|
-
export declare const
|
|
31
|
+
export declare const layeredLitCssFlag = "?layeredLitCss";
|
|
16
32
|
/**
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
33
|
+
* Vite's library mode has CSS support (https://vite.dev/guide/build.html#css-support).
|
|
34
|
+
* However, if global css file references assets, the library mode will insert
|
|
35
|
+
* the assets base path in the CSS file. This does not work for us since the
|
|
36
|
+
* asset path is determined at runtime - provided by the user.
|
|
37
|
+
*
|
|
38
|
+
* Additionally, Vite's library mode css handling does not quite fit our use case:
|
|
39
|
+
* - We need to transform the global CSS to add hydrate CSS
|
|
40
|
+
* - Trickier given that we need to emit hydrate CSS even if user did not
|
|
41
|
+
* provide global css
|
|
42
|
+
* - Vite has css chunking support, which we don't need
|
|
43
|
+
* - We need to add an import for our CSS file (and those of libraries we are
|
|
44
|
+
* consuming) in runtime.ts, without processing the external CSS files
|
|
45
|
+
*
|
|
46
|
+
* It is possible to make Vite's library mode css work, but requires too much
|
|
47
|
+
* effort. Instead, we are bypassing Vite's global CSS handling and doing the
|
|
48
|
+
* simple handling sufficient for our single global css file:
|
|
49
|
+
* - During build, we insert a import into the loader.ts file purely
|
|
50
|
+
* so that the transform() is triggered for that file so that we can piggy back
|
|
51
|
+
* on the transformed output (and create a separate .css file out of it).
|
|
52
|
+
* Such import has no side-effects and is removed by Rollup.
|
|
53
|
+
*
|
|
54
|
+
* This is the only way to trigger the CSS transform without getting it added
|
|
55
|
+
* to the bundle because of this Vite behavior:
|
|
56
|
+
* https://github.com/vitejs/vite/pull/11469#:~:text=Further%2C%20this.load%20is%20supposed%20to%20trigger%20transform%20and%20moduleParsed%20%2D%20this%20does%20not%20(in%20accordance%20with%20vite%27s%20on%2Ddemand%20nature
|
|
57
|
+
* - We manually write dist/main.css based on hydrate CSS and global CSS.
|
|
58
|
+
* - During generateBundle() stage, we transform the emitted chunks/runtime.js
|
|
59
|
+
* to add the import to global CSS for our library and web component libraries
|
|
60
|
+
* we are consuming. We do this in generateBundle() stage so that such imports
|
|
61
|
+
* are not processed by bundler. Additionally, our loadLitCss plugin's
|
|
62
|
+
* transform() has a detection of side-effect CSS imports to error for them
|
|
63
|
+
* saying they should be import as named to be added to the shadow root - by
|
|
64
|
+
* doing this in generateBundle(), we bypass that check.
|
|
25
65
|
*/
|
|
26
|
-
export declare const
|
|
66
|
+
export declare const globalCssFileFlag = "?globalFileLitCss";
|
|
27
67
|
/**
|
|
28
68
|
* Given a CSS file like:
|
|
29
69
|
*
|
|
@@ -56,7 +96,7 @@ export declare const globalCssFlag = "?global";
|
|
|
56
96
|
*
|
|
57
97
|
* Then, we augment it into this:
|
|
58
98
|
* ```js
|
|
59
|
-
* import { css } from '
|
|
99
|
+
* import { css } from 'lit/css-tag.js';
|
|
60
100
|
* const styles = css`:host{display:flex;gap:1rem}button{padding:1rem}`;
|
|
61
101
|
* export default styles;
|
|
62
102
|
* ```
|
|
@@ -84,3 +124,4 @@ export declare const globalCssFlag = "?global";
|
|
|
84
124
|
* will be inlined as base64 to simplify our life.
|
|
85
125
|
*/
|
|
86
126
|
export declare const loadLitCss: (context: CompilerContext) => Plugin;
|
|
127
|
+
export declare function viteCssModuleToLit(code: string, withHmr: boolean, minify: boolean, isLayered: boolean): string;
|
package/dist/publicTypes.d.ts
CHANGED
|
@@ -3,9 +3,9 @@ import { Plugin } from 'vite';
|
|
|
3
3
|
import { build as esbuildBuild } from 'esbuild';
|
|
4
4
|
import { CompilerContext } from './context';
|
|
5
5
|
import { PluginOptions as VitePluginDtsOptions } from 'vite-plugin-dts';
|
|
6
|
-
import { ExternalsOptions as RollupPluginNodeExternalsOptions } from 'rollup-plugin-node-externals';
|
|
7
6
|
import { WebTypesOptions } from './docs/webTypes/types';
|
|
8
7
|
import { VsCodeDocOptions } from './docs/vsCodeCustomData/types';
|
|
8
|
+
import { DependencyManagementOptions as BaseDependencyManagementOptions } from '@arcgis/components-build-utils';
|
|
9
9
|
import { ApiJson, ApiModule, CopyDocDefinitions } from '@arcgis/api-extractor';
|
|
10
10
|
import { LuminaApiExtractor } from './extractor/extractor';
|
|
11
11
|
/**
|
|
@@ -64,6 +64,10 @@ export type LuminaOptions = {
|
|
|
64
64
|
*/
|
|
65
65
|
readonly assets?: AssetHandlingOptions;
|
|
66
66
|
readonly linting?: LintingOptions;
|
|
67
|
+
readonly experimental?: {
|
|
68
|
+
/** @deprecated See https://discord.com/channels/1012791295170859069/1047015641225371718 */
|
|
69
|
+
readonly stabilizeRef?: boolean;
|
|
70
|
+
};
|
|
67
71
|
};
|
|
68
72
|
export type BuildOptions = {
|
|
69
73
|
/**
|
|
@@ -79,9 +83,13 @@ export type BuildOptions = {
|
|
|
79
83
|
* @default undefined
|
|
80
84
|
* @example "www"
|
|
81
85
|
* @see [Based on Stencil's www build](https://stenciljs.com/docs/www)
|
|
82
|
-
* @deprecated Use Storybook build or separate test app package.
|
|
86
|
+
* @deprecated Use Storybook build or a separate test app package.
|
|
83
87
|
*/
|
|
84
88
|
readonly destination?: string;
|
|
89
|
+
/** @deprecated Use Storybook build or a separate test app package. */
|
|
90
|
+
readonly transformFile?: (htmlContent: string, htmlFilePath: string, context: CompilerContext) => string;
|
|
91
|
+
/** @deprecated Use Storybook build or a separate test app package. */
|
|
92
|
+
readonly afterBuildEnd?: (context: CompilerContext) => Promise<void> | void;
|
|
85
93
|
};
|
|
86
94
|
/**
|
|
87
95
|
* Options for externalizing or bundling in dependencies.
|
|
@@ -92,7 +100,7 @@ export type BuildOptions = {
|
|
|
92
100
|
* New lines are accepted.
|
|
93
101
|
* Do not include // or /* - will be added automatically.
|
|
94
102
|
*
|
|
95
|
-
* @default require("@arcgis/
|
|
103
|
+
* @default require("@arcgis/toolkit/string").getPreamble()
|
|
96
104
|
*
|
|
97
105
|
* @example
|
|
98
106
|
* ```js
|
|
@@ -113,7 +121,6 @@ export type BuildOptions = {
|
|
|
113
121
|
* Wrappers to generate.
|
|
114
122
|
*/
|
|
115
123
|
readonly wrappers?: WrappersOptions[];
|
|
116
|
-
readonly ssr?: SsrOptions;
|
|
117
124
|
};
|
|
118
125
|
export type BuildCdnOptions = {
|
|
119
126
|
/**
|
|
@@ -149,7 +156,15 @@ export type BuildCdnOptions = {
|
|
|
149
156
|
*/
|
|
150
157
|
readonly esbuildOptions?: Parameters<typeof esbuildBuild>[0];
|
|
151
158
|
/**
|
|
152
|
-
*
|
|
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.
|
|
153
168
|
* This callback is for advanced use cases only. The build output may change
|
|
154
169
|
* between Lumina versions without prior notice. Using this callback may
|
|
155
170
|
* corrupt the CDN source map if it is enabled.
|
|
@@ -158,6 +173,11 @@ export type BuildCdnOptions = {
|
|
|
158
173
|
};
|
|
159
174
|
export type CdnChunk = {
|
|
160
175
|
code: string;
|
|
176
|
+
/**
|
|
177
|
+
* Whether chunk is currently being processed. Used to detect cyclical imports.
|
|
178
|
+
* @private
|
|
179
|
+
*/
|
|
180
|
+
isProcessing: boolean;
|
|
161
181
|
isAsync: boolean | undefined;
|
|
162
182
|
oldSingleExportName: string | undefined;
|
|
163
183
|
};
|
|
@@ -168,32 +188,6 @@ export type CdnChunk = {
|
|
|
168
188
|
* https://devtopia.esri.com/WebGIS/arcgis-web-components/discussions/1281
|
|
169
189
|
*/
|
|
170
190
|
export type WrappersOptions = React18WrapperOptions;
|
|
171
|
-
export type SsrOptions = {
|
|
172
|
-
/**
|
|
173
|
-
* Emit output compatible with Stencil's dist-hydrate-script build.
|
|
174
|
-
*
|
|
175
|
-
* @deprecated
|
|
176
|
-
* This option should be used to smooth the migration path from Stencil.
|
|
177
|
-
* You should instruct your SSR users to migrate to Lit's SSR implementation,
|
|
178
|
-
* and then stop using this option.
|
|
179
|
-
*
|
|
180
|
-
* @see https://stenciljs.com/docs/hydrate-app
|
|
181
|
-
* @see https://lit.dev/docs/ssr/overview/
|
|
182
|
-
*/
|
|
183
|
-
readonly stencilCompatibility?: {
|
|
184
|
-
/**
|
|
185
|
-
* @default false
|
|
186
|
-
*/
|
|
187
|
-
enabled?: boolean;
|
|
188
|
-
/**
|
|
189
|
-
* By default, the hydrate directory is output to package root, outside
|
|
190
|
-
* of dist.
|
|
191
|
-
*
|
|
192
|
-
* @default "hydrate"
|
|
193
|
-
*/
|
|
194
|
-
path?: string;
|
|
195
|
-
};
|
|
196
|
-
};
|
|
197
191
|
/**
|
|
198
192
|
* Options for creating React 18 wrapper.
|
|
199
193
|
*
|
|
@@ -211,46 +205,31 @@ export type React18WrapperOptions = {
|
|
|
211
205
|
/**
|
|
212
206
|
* Options for externalizing dependencies.
|
|
213
207
|
*
|
|
214
|
-
* Reuse the options from rollup-plugin-node-externals, but rename two options for clarity.
|
|
215
|
-
* - `include` is renamed to `externalize` to make it clear that these are externalized
|
|
216
|
-
* - `exclude` is renamed to `bundleIn` to make it clear that these are bundled in
|
|
217
|
-
*
|
|
218
|
-
* @see https://www.npmjs.com/package/rollup-plugin-node-externals
|
|
219
|
-
*
|
|
220
208
|
* @remarks
|
|
221
209
|
* If Vite is running under Storybook, these options are ignored. This is
|
|
222
210
|
* because in Storybook build, unlike in a library build, we want to bundle in
|
|
223
211
|
* all dependencies (with exception of @arcgis/core and web component
|
|
224
212
|
* dependencies, which are loaded using the ESM CDN).
|
|
225
213
|
*/
|
|
226
|
-
export type DependencyManagementOptions =
|
|
214
|
+
export type DependencyManagementOptions = BaseDependencyManagementOptions & {
|
|
227
215
|
/**
|
|
228
|
-
*
|
|
229
|
-
*
|
|
230
|
-
*
|
|
231
|
-
* @example
|
|
232
|
-
* This is desirable if you wish to control the version of a dependency or
|
|
233
|
-
* need to post-process the dependency in some way. Usually, you will declare
|
|
234
|
-
* such as a devDependency, but there is a use case for declaring it as a
|
|
235
|
-
* dependency instead:
|
|
216
|
+
* By default, Lumina will error if it encounters usage of an unknown custom
|
|
217
|
+
* element. This setting allows to silence such error if you are manually
|
|
218
|
+
* importing some custom elements.
|
|
236
219
|
*
|
|
237
|
-
*
|
|
238
|
-
*
|
|
239
|
-
*
|
|
240
|
-
*
|
|
241
|
-
*
|
|
242
|
-
*/
|
|
243
|
-
readonly bundleIn?: NonNullable<RollupPluginNodeExternalsOptions>["exclude"];
|
|
244
|
-
/**
|
|
245
|
-
* Force externalize these dependencies, even if they are declared as
|
|
246
|
-
* devDependencies.
|
|
220
|
+
* > [!IMPORTANT]
|
|
221
|
+
* >
|
|
222
|
+
* > This option is an escape hatch. Build-time optimizations are not applied
|
|
223
|
+
* > to such custom elements. Additionally, you assume the responsibility for
|
|
224
|
+
* > correctly loading the web component in lazy, non-lazy and CDN builds.
|
|
247
225
|
*
|
|
248
226
|
* @example
|
|
249
|
-
*
|
|
250
|
-
*
|
|
251
|
-
*
|
|
227
|
+
* ```ts
|
|
228
|
+
* // Silence errors for unknown custom elements that start with "fluent-"
|
|
229
|
+
* silenceUnknownJsxElementUsage: (tagName) => tagName.startsWith("fluent-")
|
|
230
|
+
* ```
|
|
252
231
|
*/
|
|
253
|
-
readonly
|
|
232
|
+
readonly silenceUnknownJsxElementUsage?: (tagName: string, fileName: string, context: CompilerContext) => boolean;
|
|
254
233
|
};
|
|
255
234
|
export type ServeEnvironmentOptions = {
|
|
256
235
|
/**
|
|
@@ -274,7 +253,11 @@ export type ServeEnvironmentOptions = {
|
|
|
274
253
|
export type DetailedExtraDependency = {
|
|
275
254
|
/** @example "@arcgis/map-config-components" */
|
|
276
255
|
name: string;
|
|
277
|
-
/**
|
|
256
|
+
/**
|
|
257
|
+
* Overwrite the default CDN asset path for this dependency.
|
|
258
|
+
*
|
|
259
|
+
* @example (): string => `https://example.com/arcgis-components/builds/main/cdn/map-config-components/`
|
|
260
|
+
*/
|
|
278
261
|
getCdnUrl: (context: CompilerContext) => string;
|
|
279
262
|
};
|
|
280
263
|
export type PuppeteerTestingOptions = {
|
|
@@ -537,65 +520,27 @@ export type CssHandlingOptions = {
|
|
|
537
520
|
* @default "hydrated"
|
|
538
521
|
*/
|
|
539
522
|
hydratedAttribute?: string;
|
|
540
|
-
/**
|
|
541
|
-
* By default, if a side effect CSS import is detected, an error will thrown.
|
|
542
|
-
* This is due to the requirement of handling shadow DOM styling.
|
|
543
|
-
* Instead, you should import the "styles" variable from the .css file and add
|
|
544
|
-
* it to your component.
|
|
545
|
-
*
|
|
546
|
-
* If there is a side effect CSS import from a file you don't control (i.e a
|
|
547
|
-
* library you are using), then assign this property to a function that would
|
|
548
|
-
* return "drop" to ignore those imports. In such case, you will be
|
|
549
|
-
* responsible for manually providing the styles to the web component.
|
|
550
|
-
*
|
|
551
|
-
* If neither of these is satisfactory, a more complex solution can be
|
|
552
|
-
* implemented in the future.
|
|
553
|
-
*
|
|
554
|
-
* @remarks
|
|
555
|
-
* In regular codebases, it's common to have an import statement like so:
|
|
556
|
-
* ```ts
|
|
557
|
-
* import 'some-library/styles.css';
|
|
558
|
-
* ```
|
|
559
|
-
*
|
|
560
|
-
* Doing so in a web component codebase is a bit trickier as the styles
|
|
561
|
-
* need to be attached not to the `<head>` of the page, but to the shadow
|
|
562
|
-
* root of the component that imported it. Doing so for transitive imports
|
|
563
|
-
* is even trickier (if your component imported a .js file, which in turn
|
|
564
|
-
* imported a .css file) as dependency tracking becomes necessary.
|
|
565
|
-
*
|
|
566
|
-
* That is why, for now, css imports need to be handled like so:
|
|
567
|
-
*
|
|
568
|
-
* - If import is originating from a file you control (your component file),
|
|
569
|
-
* import the "styles" variable from the css file:
|
|
570
|
-
*
|
|
571
|
-
* ```ts
|
|
572
|
-
* import { styles } from 'some-library/styles.css';
|
|
573
|
-
* ```
|
|
574
|
-
*
|
|
575
|
-
* And then add it to your component
|
|
576
|
-
*
|
|
577
|
-
* ```ts
|
|
578
|
-
* export class MyComponent extends LitElement {
|
|
579
|
-
* static override styles = styles;
|
|
580
|
-
* }
|
|
581
|
-
* ```
|
|
582
|
-
*
|
|
583
|
-
* - If the import is originating from a file you don't control (i.e a library
|
|
584
|
-
* code), you have to set this property to a function that will return
|
|
585
|
-
* "drop" for a given library import to ignore such import, and then you
|
|
586
|
-
* will have to manually provide the CSS file by importing "styles"
|
|
587
|
-
* variable.
|
|
588
|
-
*
|
|
589
|
-
* @default () => "throwError"
|
|
590
|
-
*
|
|
591
|
-
*/
|
|
592
|
-
readonly sideEffectImportHandling?: (specifier: string, importer: string) => "drop" | "throwError";
|
|
593
523
|
};
|
|
594
524
|
export type AssetHandlingOptions = {
|
|
595
525
|
/**
|
|
596
526
|
* Any additional assets you wish to provide, besides those located in the
|
|
597
527
|
* assets/ directories
|
|
598
528
|
*
|
|
529
|
+
* @example
|
|
530
|
+
* ```ts
|
|
531
|
+
* import resolvePkg from "resolve-pkg";
|
|
532
|
+
*
|
|
533
|
+
* // ...
|
|
534
|
+
*
|
|
535
|
+
* extra: [
|
|
536
|
+
* {
|
|
537
|
+
* type: "directory",
|
|
538
|
+
* source: resolvePkg("@arcgis/arcade-sdk/dist/arcgis-arcade-editor")!,
|
|
539
|
+
* destination: "arcade-language",
|
|
540
|
+
* },
|
|
541
|
+
* ]
|
|
542
|
+
* ```
|
|
543
|
+
*
|
|
599
544
|
* @remarks
|
|
600
545
|
* If you need additional flexibility, you can call the
|
|
601
546
|
* `compilerContext.provideAssets()` utility at any time
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { expect as p, afterEach as V } from "vitest";
|
|
2
2
|
import { toSystemPathSeparators as L, isPosix as S } from "@arcgis/components-build-utils";
|
|
3
3
|
import { p as T, i as h } from "../types-C3YmWTVv.js";
|
|
4
|
-
import { l as y } from "../logger-
|
|
4
|
+
import { l as y } from "../logger-hJvg0JOj.js";
|
|
5
5
|
async function D(s) {
|
|
6
6
|
await s.exposeFunction("puppeteerOnEvent", (e, t) => {
|
|
7
7
|
j(s._e2eEvents, e, t);
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
export declare const expectExtend: {
|
|
2
|
-
toEqualAttribute: import('@vitest/expect').RawMatcherFn<import('@vitest/expect').MatcherState>;
|
|
3
|
-
toEqualAttributes: import('@vitest/expect').RawMatcherFn<import('@vitest/expect').MatcherState>;
|
|
4
|
-
toEqualText: import('@vitest/expect').RawMatcherFn<import('@vitest/expect').MatcherState>;
|
|
5
|
-
toHaveAttribute: import('@vitest/expect').RawMatcherFn<import('@vitest/expect').MatcherState>;
|
|
6
|
-
toHaveClass: import('@vitest/expect').RawMatcherFn<import('@vitest/expect').MatcherState>;
|
|
2
|
+
toEqualAttribute: import('@vitest/expect').RawMatcherFn<import('@vitest/expect').MatcherState, any[]>;
|
|
3
|
+
toEqualAttributes: import('@vitest/expect').RawMatcherFn<import('@vitest/expect').MatcherState, any[]>;
|
|
4
|
+
toEqualText: import('@vitest/expect').RawMatcherFn<import('@vitest/expect').MatcherState, any[]>;
|
|
5
|
+
toHaveAttribute: import('@vitest/expect').RawMatcherFn<import('@vitest/expect').MatcherState, any[]>;
|
|
6
|
+
toHaveClass: import('@vitest/expect').RawMatcherFn<import('@vitest/expect').MatcherState, any[]>;
|
|
7
7
|
toHaveClasses: (element: unknown, expectClassNames: string[]) => import('@vitest/expect').SyncExpectationResult;
|
|
8
|
-
toMatchClasses: import('@vitest/expect').RawMatcherFn<import('@vitest/expect').MatcherState>;
|
|
9
|
-
toHaveReceivedEvent: import('@vitest/expect').RawMatcherFn<import('@vitest/expect').MatcherState>;
|
|
10
|
-
toHaveReceivedEventTimes: import('@vitest/expect').RawMatcherFn<import('@vitest/expect').MatcherState>;
|
|
11
|
-
toHaveReceivedEventDetail: import('@vitest/expect').RawMatcherFn<import('@vitest/expect').MatcherState>;
|
|
12
|
-
toHaveFirstReceivedEventDetail: import('@vitest/expect').RawMatcherFn<import('@vitest/expect').MatcherState>;
|
|
13
|
-
toHaveLastReceivedEventDetail: import('@vitest/expect').RawMatcherFn<import('@vitest/expect').MatcherState>;
|
|
14
|
-
toHaveNthReceivedEventDetail: import('@vitest/expect').RawMatcherFn<import('@vitest/expect').MatcherState>;
|
|
8
|
+
toMatchClasses: import('@vitest/expect').RawMatcherFn<import('@vitest/expect').MatcherState, any[]>;
|
|
9
|
+
toHaveReceivedEvent: import('@vitest/expect').RawMatcherFn<import('@vitest/expect').MatcherState, any[]>;
|
|
10
|
+
toHaveReceivedEventTimes: import('@vitest/expect').RawMatcherFn<import('@vitest/expect').MatcherState, any[]>;
|
|
11
|
+
toHaveReceivedEventDetail: import('@vitest/expect').RawMatcherFn<import('@vitest/expect').MatcherState, any[]>;
|
|
12
|
+
toHaveFirstReceivedEventDetail: import('@vitest/expect').RawMatcherFn<import('@vitest/expect').MatcherState, any[]>;
|
|
13
|
+
toHaveLastReceivedEventDetail: import('@vitest/expect').RawMatcherFn<import('@vitest/expect').MatcherState, any[]>;
|
|
14
|
+
toHaveNthReceivedEventDetail: import('@vitest/expect').RawMatcherFn<import('@vitest/expect').MatcherState, any[]>;
|
|
15
15
|
};
|
|
16
16
|
export interface PuppeteerMatchers<R = unknown> {
|
|
17
17
|
toEqualAttribute: (expectedAttribute: string, expectedValue: unknown) => R;
|