@arcgis/lumina-compiler 4.33.0-next.9 → 4.33.0-next.90
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 +13 -20
- package/dist/context/typeScript.d.ts +2 -2
- package/dist/context/utils.d.ts +1 -1
- package/dist/dependencies/arcgisCore.d.ts +1 -1
- package/dist/dependencies/discover.d.ts +3 -3
- package/dist/dependencies/index.d.ts +2 -2
- package/dist/dependencies/loaders.d.ts +3 -3
- package/dist/dependencies/lumina.d.ts +2 -0
- package/dist/dependencies/stencil.d.ts +1 -1
- package/dist/dependencies/testSetupFiles.d.ts +1 -1
- package/dist/dependencies/updateLumina.d.ts +4 -4
- package/dist/dependencies/utils.d.ts +2 -2
- package/dist/docs/config.d.ts +1 -1
- package/dist/docs/index.d.ts +2 -2
- package/dist/docs/stencilDocsJson.d.ts +3 -3
- package/dist/docs/vsCodeCustomData/index.d.ts +2 -2
- package/dist/docs/vsCodeCustomData/utils.d.ts +2 -2
- package/dist/docs/webTypes/description.d.ts +1 -1
- package/dist/docs/webTypes/index.d.ts +2 -2
- package/dist/docs/webTypes/utils.d.ts +2 -2
- package/dist/entrypoints/addNonLazyImports.d.ts +2 -2
- package/dist/entrypoints/config.d.ts +1 -0
- package/dist/entrypoints/dtsUtils.d.ts +3 -3
- package/dist/entrypoints/findUtils.d.ts +1 -1
- package/dist/entrypoints/handleComponentImports.d.ts +2 -2
- package/dist/entrypoints/pathMapping.d.ts +1 -1
- package/dist/entrypoints/resolveTagName.d.ts +3 -3
- package/dist/extractor/apiJsonUtils.d.ts +2 -2
- package/dist/extractor/declaration.d.ts +1 -38
- package/dist/extractor/extractor.d.ts +5 -6
- package/dist/extractor/helpers/cssDoc.d.ts +1 -1
- package/dist/extractor/helpers/event.d.ts +3 -3
- package/dist/extractor/helpers/jsDoc.d.ts +2 -2
- package/dist/extractor/helpers/method.d.ts +3 -3
- package/dist/extractor/helpers/property.d.ts +3 -3
- package/dist/extractor/helpers/resolveType.d.ts +3 -3
- package/dist/extractor/helpers/typeValue.d.ts +2 -2
- package/dist/extractor/index.d.ts +3 -3
- package/dist/frameworkTypes/index.d.ts +2 -2
- package/dist/frameworkTypes/lumina.d.ts +1 -1
- package/dist/frameworkTypes/preact.d.ts +1 -1
- package/dist/frameworkTypes/react.d.ts +1 -1
- package/dist/frameworkTypes/stencil.d.ts +1 -1
- package/dist/frameworkTypes/utils.d.ts +2 -2
- package/dist/frameworkTypes/vanilla.d.ts +1 -1
- package/dist/index.d.ts +10 -10
- package/dist/index.js +6482 -106
- package/dist/jsxToLitHtml/autoAddNothing.d.ts +2 -2
- package/dist/jsxToLitHtml/comments.d.ts +4 -4
- package/dist/jsxToLitHtml/convertProps.d.ts +5 -6
- package/dist/jsxToLitHtml/imports.d.ts +2 -2
- package/dist/jsxToLitHtml/index.d.ts +1 -1
- package/dist/jsxToLitHtml/inferPropType.d.ts +3 -3
- package/dist/jsxToLitHtml/insertRepeatCall.d.ts +2 -2
- package/dist/jsxToLitHtml/jsxVisitor.d.ts +3 -4
- package/dist/jsxToLitHtml/templateParts.d.ts +2 -2
- package/dist/jsxToLitHtml/throwOnImportingExternalized.d.ts +1 -1
- package/dist/jsxToLitHtml/types.d.ts +5 -4
- package/dist/jsxToLitHtml/utils.d.ts +1 -0
- package/dist/loader/hideUntilHydrated.d.ts +1 -1
- package/dist/loader/index.d.ts +2 -2
- package/dist/loader/lazy.d.ts +3 -3
- package/dist/loader/storybookApiJson.d.ts +1 -1
- package/dist/plugins/buildCdn.d.ts +72 -6
- package/dist/plugins/buildStencilHydrate.d.ts +2 -2
- package/dist/plugins/buildWebApp.d.ts +3 -0
- package/dist/plugins/buildWrappers.d.ts +2 -2
- package/dist/plugins/configureVite.d.ts +4 -4
- package/dist/plugins/externalizeDependencies.d.ts +2 -6
- package/dist/plugins/handleDynamicAssets.d.ts +2 -2
- package/dist/plugins/handleStaticAssets.d.ts +2 -2
- package/dist/plugins/loadLitCss.d.ts +2 -6
- package/dist/plugins/printTotalBuildSize.d.ts +2 -2
- package/dist/plugins/provideAssets.d.ts +3 -20
- package/dist/plugins/setAssetsPath.d.ts +2 -2
- package/dist/plugins/updatePackageJson.d.ts +3 -3
- package/dist/publicTypes.d.ts +25 -13
- package/dist/puppeteerTesting/globalSetup.d.ts +2 -2
- package/dist/puppeteerTesting/globalSetup.js +105 -2
- package/dist/puppeteerTesting/index.d.ts +7 -8
- package/dist/puppeteerTesting/index.js +1129 -5
- package/dist/puppeteerTesting/injected.d.ts +1 -1
- package/dist/puppeteerTesting/puppeteer/browser.d.ts +1 -1
- package/dist/puppeteerTesting/puppeteer/element.d.ts +3 -3
- package/dist/puppeteerTesting/puppeteer/events.d.ts +2 -2
- package/dist/puppeteerTesting/puppeteer/page.d.ts +1 -1
- package/dist/puppeteerTesting/puppeteer/types.d.ts +3 -3
- package/dist/puppeteerTesting/vitest/matchers/attributes.d.ts +1 -1
- package/dist/puppeteerTesting/vitest/matchers/classList.d.ts +1 -1
- package/dist/puppeteerTesting/vitest/matchers/events.d.ts +1 -1
- package/dist/puppeteerTesting/vitest/matchers/index.d.ts +13 -13
- package/dist/puppeteerTesting/vitest/matchers/text.d.ts +1 -1
- package/dist/puppeteerTesting/vitest/runner.d.ts +3 -3
- package/dist/puppeteerTesting/vitest/runner.js +50 -1
- package/dist/puppeteerTesting/vitest/types.d.ts +1 -1
- package/dist/testing/index.d.ts +4 -4
- package/dist/testing/index.js +181 -24
- package/dist/testing/mount.d.ts +2 -2
- package/dist/testing/wrapController.d.ts +2 -2
- package/dist/tests/utils.d.ts +2 -2
- package/dist/transformers/index.d.ts +3 -3
- package/dist/transformers/injectRuntimeOptions.d.ts +2 -2
- package/dist/transformers/internalTypeScriptApis.d.ts +2 -2
- package/dist/transformers/liftDecorators.d.ts +1 -1
- package/dist/transformers/members.d.ts +2 -2
- package/dist/transformers/property.d.ts +4 -4
- package/dist/transformers/propertyOptions.d.ts +5 -5
- package/dist/transformers/utils.d.ts +3 -3
- package/dist/types/astTransformers.d.ts +2 -2
- package/dist/types/failOnJsonImport.d.ts +1 -1
- package/dist/types/hideInternalLitElement.d.ts +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/liftSetterTypes.d.ts +2 -3
- package/dist/types/textTransformers.d.ts +2 -2
- package/dist/types/transformComponentMembers.d.ts +1 -1
- package/dist/types-C3YmWTVv.js +13 -0
- package/dist/useLumina.d.ts +1 -1
- package/package.json +6 -5
- package/dist/chunk-6XNX5V4L.js +0 -1
- package/dist/chunk-JFKSI6I7.js +0 -1
- package/dist/context/typeScript.spec.d.ts +0 -1
- package/dist/context/utils.spec.d.ts +0 -1
- package/dist/defaultAssetsUrl.spec.d.ts +0 -1
- package/dist/dependencies/lit.d.ts +0 -2
- package/dist/dependencies/updateLumina.spec.d.ts +0 -1
- package/dist/docs/steniclDocsJson.test.d.ts +0 -1
- package/dist/entrypoints/dtsUtils.spec.d.ts +0 -1
- package/dist/entrypoints/findUtils.spec.d.ts +0 -1
- package/dist/entrypoints/resolveTagName.spec.d.ts +0 -1
- package/dist/extractor/declaration.spec.d.ts +0 -1
- package/dist/extractor/helpers/cssDoc.spec.d.ts +0 -1
- package/dist/extractor/helpers/resolveType.spec.d.ts +0 -1
- package/dist/extractor/helpers/typeValue.spec.d.ts +0 -1
- package/dist/jsxToLitHtml/utils.spec.d.ts +0 -1
- package/dist/loader/lazy.spec.d.ts +0 -1
- package/dist/plugins/buildCdn.spec.d.ts +0 -1
- package/dist/plugins/externalizeDependencies.spec.d.ts +0 -1
- package/dist/plugins/provideAssets.spec.d.ts +0 -1
- package/dist/plugins/updatePackageJson.spec.d.ts +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import { TemplatePart } from './templateParts';
|
|
2
|
+
import { JsxContext } from './types';
|
|
3
3
|
/**
|
|
4
4
|
* If JSX prop value could possibly be `undefined`, we add `?? nothing` to it.
|
|
5
5
|
*
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import ts from
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import { default as ts } from 'typescript';
|
|
2
|
+
import { JsxContext } from './types';
|
|
3
|
+
import { TemplatePart } from './templateParts';
|
|
4
4
|
/**
|
|
5
5
|
* Extract comments and whitespace from a node (called "trivia" in TypeScript)
|
|
6
6
|
*/
|
|
7
|
-
export declare const getNodeTrivia: (node: ts.Node, context: JsxContext) => string;
|
|
7
|
+
export declare const getNodeTrivia: (node: ts.Node, context: Pick<JsxContext, "sourceFile">) => string;
|
|
8
8
|
/**
|
|
9
9
|
* Attach trivia comments to a node.
|
|
10
10
|
*
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import ts from
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { dynamicHtmlSymbol } from
|
|
6
|
-
import { type dynamicSvgSymbol } from "./config";
|
|
1
|
+
import { default as ts } from 'typescript';
|
|
2
|
+
import { TemplatePart } from './templateParts';
|
|
3
|
+
import { JsxContext } from './types';
|
|
4
|
+
import { JsxPropType } from './inferPropType';
|
|
5
|
+
import { dynamicHtmlSymbol, dynamicSvgSymbol } from './config';
|
|
7
6
|
/**
|
|
8
7
|
* Handle the conversion for each JSX prop type
|
|
9
8
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import ts from
|
|
2
|
-
import {
|
|
1
|
+
import { default as ts } from 'typescript';
|
|
2
|
+
import { JsxContext } from './types';
|
|
3
3
|
export declare const dynamicallyInsertedImportPaths: Set<string>;
|
|
4
4
|
/**
|
|
5
5
|
* This runs before we know what imports will be needed.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { FileTransformer } from '../publicTypes';
|
|
2
2
|
/**
|
|
3
3
|
* Let developers author components in JSX for better type checking and developer
|
|
4
4
|
* experience, but convert JSX to lit-html at build time for better performance.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import ts from
|
|
2
|
-
import { dynamicHtmlSymbol, dynamicSvgSymbol } from
|
|
1
|
+
import { default as ts } from 'typescript';
|
|
2
|
+
import { dynamicHtmlSymbol, dynamicSvgSymbol } from './config';
|
|
3
3
|
/**
|
|
4
4
|
* Check if prop initializer has bindProperty(), bindAttribute(),
|
|
5
5
|
* bindBooleanAttribute() or bindEvent() call - these explicitly indicate the
|
|
@@ -34,7 +34,7 @@ export declare function checkExplicitPropType(initializer: ts.JsxAttributeValue
|
|
|
34
34
|
* explicitly want to overwrite the below prop type inference logic.
|
|
35
35
|
*/
|
|
36
36
|
export declare function inferPropType(propName: string, initializer: ts.JsxAttributeValue | undefined, tagName: string | typeof dynamicHtmlSymbol | typeof dynamicSvgSymbol): JsxPropType;
|
|
37
|
-
declare const specialPropsArray: readonly ["class", "style", "ref", "directives", "key"];
|
|
37
|
+
declare const specialPropsArray: readonly ["class", "style", "ref", "directives", "key", "deferLoad"];
|
|
38
38
|
type SpecialProp = (typeof specialPropsArray)[number];
|
|
39
39
|
export type JsxPropType = SpecialProp | "attribute" | "booleanAttribute" | "event" | "property";
|
|
40
40
|
export {};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import ts from
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { type JsxContext } from "./types";
|
|
1
|
+
import { default as ts } from 'typescript';
|
|
2
|
+
import { TemplatePart } from './templateParts';
|
|
3
|
+
import { JsxHost, JsxContext } from './types';
|
|
5
4
|
/**
|
|
6
5
|
* Recursively traverse the entire AST top-down, converting JSX to lit-html.
|
|
7
6
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import ts from
|
|
2
|
-
import {
|
|
1
|
+
import { default as ts } from 'typescript';
|
|
2
|
+
import { JsxContext, LitTag, ambiguousSvgTag } from './types';
|
|
3
3
|
/**
|
|
4
4
|
* Template part is a convenient intermediate representation for template
|
|
5
5
|
* literal expressions.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import ts from
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import { default as ts } from 'typescript';
|
|
2
|
+
import { ResolvedDependencyComponents } from '../dependencies/discover';
|
|
3
|
+
import { CompilerContext } from '../context';
|
|
4
4
|
export type JsxContext = {
|
|
5
5
|
readonly compiler: CompilerContext;
|
|
6
6
|
/** Source file before the _JSX to lit-html_ transformation */
|
|
@@ -16,6 +16,7 @@ export type JsxContext = {
|
|
|
16
16
|
* remove it from the map to not confuse any following resolvers.
|
|
17
17
|
*/
|
|
18
18
|
readonly customElementsToImport: Set<string>;
|
|
19
|
+
readonly customElementsToImportDeferred: Set<string>;
|
|
19
20
|
/**
|
|
20
21
|
* Existing imported modules.
|
|
21
22
|
*
|
|
@@ -64,7 +65,7 @@ export declare const mathMlTag = "mathml";
|
|
|
64
65
|
declare const litTagsArray: readonly ["css", "html", "mathml", "staticHtml", "staticSvg", "svg"];
|
|
65
66
|
export declare const litTags: Set<"html" | "css" | "mathml" | "staticHtml" | "staticSvg" | "svg">;
|
|
66
67
|
export type LitTag = (typeof litTagsArray)[number];
|
|
67
|
-
export declare const jsxImportNames: readonly ["keyed", "ref", "repeat", "live", "css", "html", "mathml", "staticHtml", "staticSvg", "svg", "safeClassMap", "safeStyleMap", "nothing"];
|
|
68
|
+
export declare const jsxImportNames: readonly ["keyed", "ref", "repeat", "live", "css", "html", "mathml", "staticHtml", "staticSvg", "svg", "safeClassMap", "safeStyleMap", "deferLoad", "nothing"];
|
|
68
69
|
export type JsxImportName = (typeof jsxImportNames)[number];
|
|
69
70
|
export type JsxHost = ts.JsxElement | ts.JsxFragment | ts.JsxSelfClosingElement;
|
|
70
71
|
export declare const isJsxHost: (node: ts.Node) => node is JsxHost;
|
|
@@ -11,3 +11,4 @@ export declare function safeTrimText(text: string): string;
|
|
|
11
11
|
export declare const escapeForTemplateLiteral: (string: string) => string;
|
|
12
12
|
export declare const shouldQuoteAttributeValue: (value: string) => boolean;
|
|
13
13
|
export declare const escapeForHtml: (string: string) => string;
|
|
14
|
+
export declare const isCustomElement: (tagName: string | symbol) => tagName is string;
|
package/dist/loader/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { Plugin as VitePlugin } from 'vite';
|
|
2
|
+
import { CompilerContext } from '../context';
|
|
3
3
|
/**
|
|
4
4
|
* Generate virtual files:
|
|
5
5
|
* - loader.ts (for lazy loading components)
|
package/dist/loader/lazy.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import { CompilerContext } from '../context';
|
|
2
|
+
import { HmrComponentMeta } from '@arcgis/lumina/hmrSupport';
|
|
3
|
+
import { ApiCustomElementDeclaration } from '@arcgis/api-extractor';
|
|
4
4
|
/**
|
|
5
5
|
* To power bundle splitting for lazy loadable components, as well as to support
|
|
6
6
|
* calling async methods before the component loaded, and to ensure frameworks
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { Plugin } from 'vite';
|
|
2
|
+
import { CompilerContext } from '../context';
|
|
3
3
|
/**
|
|
4
4
|
* Restricted due to collisions with Lumina's dist/ folder names or
|
|
5
5
|
* Stencil's dist/ folder names
|
|
@@ -12,10 +12,76 @@ export declare const defaultNamespace = "cdn";
|
|
|
12
12
|
* are assumed to be defined in the environment separately)
|
|
13
13
|
*/
|
|
14
14
|
export declare function buildCdn(context: CompilerContext): Plugin | undefined;
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
type Chunk = {
|
|
16
|
+
code: string;
|
|
17
|
+
isAsync: boolean | undefined;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Transform each core-importing chunk to use $arcgis.t for loading core in
|
|
21
|
+
* order to be both ESM and AMD CDN compatible.
|
|
22
|
+
*
|
|
23
|
+
* Previous solution
|
|
24
|
+
* (https://devtopia.esri.com/WebGIS/arcgis-web-components/pull/2995) relied on
|
|
25
|
+
* top-level await. However, due to a Safari bug
|
|
26
|
+
* (see https://devtopia.esri.com/WebGIS/arcgis-web-components/issues/3933
|
|
27
|
+
* and https://bugs.webkit.org/show_bug.cgi?id=242740), we are no longer using
|
|
28
|
+
* top-level await.
|
|
29
|
+
*
|
|
30
|
+
* Instead, we insert a top-level await polyfill - a promise called $$ is
|
|
31
|
+
* exported by core-containing modules - such promise needs to be awaited by the
|
|
32
|
+
* consuming modules before the imported variables are available.
|
|
33
|
+
*
|
|
34
|
+
* List of other solutions considered:
|
|
35
|
+
* https://devtopia.esri.com/WebGIS/arcgis-web-components/discussions/3999
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```js
|
|
39
|
+
* /// BEFORE
|
|
40
|
+
* import { b } from "./U7MU7PMX.js";
|
|
41
|
+
* import { when as M } from "@arcgis/core/core/reactiveUtils.js";
|
|
42
|
+
* var s = class extends v {
|
|
43
|
+
* // ...
|
|
44
|
+
* };
|
|
45
|
+
* export { s as ArcgisNavigationToggle };
|
|
46
|
+
*
|
|
47
|
+
* /// AFTER
|
|
48
|
+
* // $$ is a promise we need to await before imports from that module are available
|
|
49
|
+
* import { $$ as _0, b } from "./U7MU7PMX.js";
|
|
50
|
+
* var _1,
|
|
51
|
+
* $$ = $arcgis.t(
|
|
52
|
+
* ([{ when: M }]) => {
|
|
53
|
+
* // The "meat" of the file is kept unchanged by the transform
|
|
54
|
+
* // (we only touch the imports, and the very last export line)
|
|
55
|
+
* s = class extends v {
|
|
56
|
+
* // ...
|
|
57
|
+
* };
|
|
58
|
+
* // Assign exported variables to global scope variables
|
|
59
|
+
* _1 = s;
|
|
60
|
+
* },
|
|
61
|
+
* "core/reactiveUtils",
|
|
62
|
+
* _0,
|
|
63
|
+
* );
|
|
64
|
+
* // _1 will only be assigned once $$ resolves
|
|
65
|
+
* export { $$, _1 as ArcgisNavigationToggle };
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
declare function transformChunk(chunk: Chunk, chunks: Map<string, Chunk>): void;
|
|
69
|
+
/**
|
|
70
|
+
* @example Dynamic core import
|
|
71
|
+
* ```diff
|
|
72
|
+
* - import("core/Handles");
|
|
73
|
+
* + $arcgis.t(_=>_[0],"core/Handles")
|
|
74
|
+
* ```
|
|
75
|
+
*
|
|
76
|
+
* @example Dynamic import of a chunk with top-level await
|
|
77
|
+
* ```diff
|
|
78
|
+
* - import("./chunk.js");
|
|
79
|
+
* + import("./chunk.js").then(m=>m.$$.then(_=>m))
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
declare function transformDynamicCoreImports(code: string, chunks: Map<string, Chunk>): string;
|
|
17
83
|
export declare const exportsForTests: {
|
|
18
|
-
|
|
19
|
-
|
|
84
|
+
transformDynamicCoreImports: typeof transformDynamicCoreImports;
|
|
85
|
+
transformChunk: typeof transformChunk;
|
|
20
86
|
};
|
|
21
87
|
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { Plugin } from 'vite';
|
|
2
|
+
import { CompilerContext } from '../context';
|
|
3
3
|
export declare function buildWrappers(context: CompilerContext): Plugin;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
import { Plugin } from 'vite';
|
|
2
|
+
import { CompilerContext } from '../context';
|
|
3
|
+
import { PuppeteerLaunchOptions } from 'puppeteer';
|
|
4
|
+
import { InlineConfig } from 'vitest/node';
|
|
5
5
|
export type PuppeteerVitestConfigOptions = InlineConfig & {
|
|
6
6
|
puppeteerLaunchOptions?: PuppeteerLaunchOptions;
|
|
7
7
|
puppeteerWaitForChangesDelay?: number;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import type { CompilerContext } from "../context";
|
|
1
|
+
import { Plugin } from 'vite';
|
|
2
|
+
import { CompilerContext } from '../context';
|
|
4
3
|
/**
|
|
5
4
|
* By default, Rollup will bundle-in all dependencies.
|
|
6
5
|
*
|
|
@@ -29,6 +28,3 @@ import type { CompilerContext } from "../context";
|
|
|
29
28
|
* be externalized (because all peerDependencies are externalized).
|
|
30
29
|
*/
|
|
31
30
|
export declare function externalizeDependencies(context: CompilerContext): Plugin;
|
|
32
|
-
export declare const exportsForTests: {
|
|
33
|
-
normalizeGlobs: (option: Nil | RegExp | string | false) => RegExp | undefined;
|
|
34
|
-
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { Plugin } from 'vite';
|
|
2
|
+
import { CompilerContext } from '../context';
|
|
3
3
|
export declare const handleDynamicAssets: (context: CompilerContext) => Plugin;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { Plugin } from 'vite';
|
|
2
|
+
import { CompilerContext } from '../context';
|
|
3
3
|
/**
|
|
4
4
|
* This is similar to Stencil's assets hosting, but to improve DX, the assets
|
|
5
5
|
* belonging to each component are moved into a folder named after the component
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* to this file may need to be reflected there too
|
|
4
|
-
*/
|
|
5
|
-
import type { Plugin } from "vite";
|
|
6
|
-
import type { CompilerContext } from "../context";
|
|
1
|
+
import { Plugin } from 'vite';
|
|
2
|
+
import { CompilerContext } from '../context';
|
|
7
3
|
export declare const cssLangsRe: RegExp;
|
|
8
4
|
/**
|
|
9
5
|
* The `.adoptedStyleSheets` API is very convenient, but it has one issue: it
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { Plugin } from 'vite';
|
|
2
|
+
import { CompilerContext } from '../context';
|
|
3
3
|
/**
|
|
4
4
|
* Augmenting vite's default reporter to not just report bundle sizes, but to
|
|
5
5
|
* also print the total size
|
|
@@ -1,23 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*
|
|
5
|
-
* This is similar to Vite's public directory, except that you can provide
|
|
6
|
-
* multiple directories and re-map the path at which the files are served.
|
|
7
|
-
*
|
|
8
|
-
* @remarks
|
|
9
|
-
* The functionality is similar to
|
|
10
|
-
* https://github.com/nguyenbatranvan/vite-multiple-assets/blob/main/packages/libs/index.ts
|
|
11
|
-
*
|
|
12
|
-
* But with improvements:
|
|
13
|
-
* - support scoping assets
|
|
14
|
-
* - copy files in parallel rather than sequentially
|
|
15
|
-
* - greater type safety and uses modern Node.js features
|
|
16
|
-
* - transform the assets (i.e minify JSON)
|
|
17
|
-
*/
|
|
18
|
-
import type { CompilerContext } from "../context";
|
|
19
|
-
import type { AssetSpec, AssetTransformer } from "../publicTypes";
|
|
20
|
-
import type { ContextDirectories } from "../context/types";
|
|
1
|
+
import { CompilerContext } from '../context';
|
|
2
|
+
import { AssetSpec, AssetTransformer } from '../publicTypes';
|
|
3
|
+
import { ContextDirectories } from '../context/types';
|
|
21
4
|
export declare function serveAssets(context: CompilerContext, assets: AssetSpec[], transformers?: AssetTransformer[]): void;
|
|
22
5
|
export declare function writeAssets(context: CompilerContext, assets: AssetSpec[], transformers?: AssetTransformer[]): Promise<void>;
|
|
23
6
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import { MiniPackageJson } from '@arcgis/components-build-utils';
|
|
2
|
+
import { CompilerContext } from '../context';
|
|
3
|
+
import { Plugin } from 'vite';
|
|
4
4
|
export declare const updatePackageJson: (context: CompilerContext) => Plugin;
|
|
5
5
|
declare function doPackageJsonUpdate(packageJson: MiniPackageJson, context: Pick<CompilerContext, "_documentationFileNames" | "dir">): MiniPackageJson | undefined;
|
|
6
6
|
export declare const exportsForTests: {
|
package/dist/publicTypes.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
1
|
+
import { default as ts } from 'typescript';
|
|
2
|
+
import { Plugin } from 'vite';
|
|
3
|
+
import { build as esbuildBuild } from 'esbuild';
|
|
4
|
+
import { CompilerContext } from './context';
|
|
5
|
+
import { PluginOptions as VitePluginDtsOptions } from 'vite-plugin-dts';
|
|
6
|
+
import { ExternalsOptions as RollupPluginNodeExternalsOptions } from 'rollup-plugin-node-externals';
|
|
7
|
+
import { PuppeteerLaunchOptions } from 'puppeteer';
|
|
8
|
+
import { WebTypesOptions } from './docs/webTypes/types';
|
|
9
|
+
import { VsCodeDocOptions } from './docs/vsCodeCustomData/types';
|
|
10
|
+
import { ApiJson, ApiModule } from '@arcgis/api-extractor';
|
|
11
|
+
import { LuminaApiExtractor } from './extractor/extractor';
|
|
12
12
|
/**
|
|
13
13
|
* `useLumina()` returns an array of Vite plugins. The array additionally
|
|
14
14
|
* has a `context` property for accessing the compiler context.
|
|
@@ -71,6 +71,18 @@ export type BuildOptions = {
|
|
|
71
71
|
* Configuration for CDN build.
|
|
72
72
|
*/
|
|
73
73
|
readonly cdn?: BuildCdnOptions;
|
|
74
|
+
readonly webApp?: {
|
|
75
|
+
/**
|
|
76
|
+
* If set, will produce a web app build, based on index.html files and
|
|
77
|
+
* cdn build.
|
|
78
|
+
*
|
|
79
|
+
* @default undefined
|
|
80
|
+
* @example "www"
|
|
81
|
+
* @see [Based on Stencil's www build](https://stenciljs.com/docs/www)
|
|
82
|
+
* @deprecated Use Storybook build or separate test app package.
|
|
83
|
+
*/
|
|
84
|
+
readonly destination?: string;
|
|
85
|
+
};
|
|
74
86
|
/**
|
|
75
87
|
* Options for externalizing or bundling in dependencies.
|
|
76
88
|
*/
|
|
@@ -276,13 +288,13 @@ export type GenerateDocumentationOptions = {
|
|
|
276
288
|
* This URL will be visible in VS Code and IntelliJ when hovering over a
|
|
277
289
|
* component tag in an .html file
|
|
278
290
|
*/
|
|
279
|
-
readonly getComponentDocsUrl?: (tag: string, name: string) => string;
|
|
291
|
+
readonly getComponentDocsUrl?: (tag: string, name: string) => string | undefined;
|
|
280
292
|
/**
|
|
281
293
|
* Provide a URL to a page that documents the component.
|
|
282
294
|
* This URL will be visible in VS Code and IntelliJ when hovering over a
|
|
283
295
|
* component tag in an .html file
|
|
284
296
|
*/
|
|
285
|
-
readonly getComponentDemoUrl?: (tag: string, name: string) => string;
|
|
297
|
+
readonly getComponentDemoUrl?: (tag: string, name: string) => string | undefined;
|
|
286
298
|
/**
|
|
287
299
|
* Additional options for web component documentation for VS Code. This
|
|
288
300
|
* documentation provides intellisense when editing .html and .css files.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import { GlobalSetupContext } from 'vitest/dist/node.js';
|
|
2
|
+
import { ConnectOptions } from 'puppeteer';
|
|
3
3
|
declare module "vitest" {
|
|
4
4
|
interface ProvidedContext {
|
|
5
5
|
isDevToolsEnabled?: boolean;
|
|
@@ -1,4 +1,95 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { launch as i } from "puppeteer";
|
|
2
|
+
import { createServer as l } from "vite";
|
|
3
|
+
async function h(r) {
|
|
4
|
+
process.cwd() !== r.config.root && process.chdir(r.config.root);
|
|
5
|
+
const [o, e] = await Promise.all([c(r), d(r)]);
|
|
6
|
+
return async () => {
|
|
7
|
+
await Promise.all([e.close(), o.close()]), setInterval(() => {
|
|
8
|
+
e.watcher.close();
|
|
9
|
+
}, 100).unref();
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
async function c(r) {
|
|
13
|
+
const o = r.config, e = o.puppeteerLaunchOptions ?? {}, t = 1e3 * 60 * 60, s = {
|
|
14
|
+
acceptInsecureCerts: !0,
|
|
15
|
+
/**
|
|
16
|
+
* Allow stopping on a "debugger;" breakpoint for 30 min. Default was 3min.
|
|
17
|
+
*/
|
|
18
|
+
protocolTimeout: e.devtools ? t : void 0,
|
|
19
|
+
/**
|
|
20
|
+
* Force animations to be enabled to run tests consistently regardless of OS
|
|
21
|
+
* settings.
|
|
22
|
+
*/
|
|
23
|
+
args: ["--force-prefers-no-reduced-motion", ...e.args ?? []],
|
|
24
|
+
...e,
|
|
25
|
+
/**
|
|
26
|
+
* The "new" headless mode is running very slow when you have multiple
|
|
27
|
+
* browser tabs open (running tests concurrently). The slowdown seems to be
|
|
28
|
+
* most prominent around `requestAnimationFrame()`, which sometimes takes
|
|
29
|
+
* up to 15s! It indeed appears that `requestAnimationFrame()` is one tab
|
|
30
|
+
* is blocked until several other tabs complete and close.
|
|
31
|
+
*
|
|
32
|
+
* All these issues are fixed by using the old headless mode. It is marked
|
|
33
|
+
* to be removed from Puppeteer in 2024. However, we are looking to migrate
|
|
34
|
+
* away from Puppeteer toward Vitest Browser Mode (Playwright) anyway.
|
|
35
|
+
*
|
|
36
|
+
* See:
|
|
37
|
+
* - https://github.com/puppeteer/puppeteer/issues/11944#issuecomment-1967860373
|
|
38
|
+
* - https://github.com/puppeteer/puppeteer/issues/10109
|
|
39
|
+
* - https://github.com/puppeteer/puppeteer/issues/12982
|
|
40
|
+
*/
|
|
41
|
+
headless: e.headless ?? (e.devtools ? void 0 : "shell")
|
|
42
|
+
}, n = await i(s), a = { ...s, browserWSEndpoint: n.wsEndpoint() };
|
|
43
|
+
return r.provide("puppeteerConnectOptions", a), r.provide("isDevToolsEnabled", s.devtools ?? !1), r.provide(
|
|
44
|
+
"isHeadlessBrowser",
|
|
45
|
+
/**
|
|
46
|
+
* Default value for headless depends on devtools argument:
|
|
47
|
+
* https://github.com/puppeteer/puppeteer/blob/b5f08d55401dcfbcfd5d885920ec5098f96ab249/packages/puppeteer-core/src/node/ChromeLauncher.ts#L241-L242
|
|
48
|
+
*/
|
|
49
|
+
e.headless === void 0 ? e.devtools !== !0 : e.headless !== !1
|
|
50
|
+
), r.provide("puppeteerWaitForChangesDelay", o.puppeteerWaitForChangesDelay), n;
|
|
51
|
+
}
|
|
52
|
+
async function d(r) {
|
|
53
|
+
const o = {
|
|
54
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
55
|
+
__IS_IN_PUPPETEER__: !0
|
|
56
|
+
}, e = await l({
|
|
57
|
+
/**
|
|
58
|
+
* Do not clutter tests console with Vite logs.
|
|
59
|
+
* Also, this matches the setting that Vitest uses when it starts up Vite.
|
|
60
|
+
*/
|
|
61
|
+
logLevel: "error",
|
|
62
|
+
server: {
|
|
63
|
+
/**
|
|
64
|
+
* Vitest should not auto-open the page (as it would do so in the default
|
|
65
|
+
* browser). Instead, if you want to see the page, you should start
|
|
66
|
+
* puppeteer in headed mode, which will open the browser for you.
|
|
67
|
+
*/
|
|
68
|
+
open: !1,
|
|
69
|
+
/**
|
|
70
|
+
* On code changes, browser page reloading will cause a Puppeteer page
|
|
71
|
+
* navigation, which will fail the test. Instead of HMR, use Vitest
|
|
72
|
+
* watch mode.
|
|
73
|
+
*/
|
|
74
|
+
hmr: !1
|
|
75
|
+
},
|
|
76
|
+
/**
|
|
77
|
+
* This should be process.cwd() in most cases, but setting in here just in
|
|
78
|
+
* case
|
|
79
|
+
*/
|
|
80
|
+
root: r.config.root,
|
|
81
|
+
// Set mode to "test"
|
|
82
|
+
mode: r.config.mode,
|
|
83
|
+
// This interferes with the Vitest output
|
|
84
|
+
clearScreen: !1,
|
|
85
|
+
define: o
|
|
86
|
+
});
|
|
87
|
+
return await e.listen(), await v(r, e), p(r, e), e;
|
|
88
|
+
}
|
|
89
|
+
async function v(r, o) {
|
|
90
|
+
const e = await o.transformIndexHtml(
|
|
91
|
+
"/",
|
|
92
|
+
`<!doctype html>
|
|
2
93
|
<html lang="en">
|
|
3
94
|
<head>
|
|
4
95
|
<meta charset="utf-8" />
|
|
@@ -8,4 +99,16 @@ import"../chunk-JFKSI6I7.js";import{launch as l}from"puppeteer";import{createSer
|
|
|
8
99
|
</head>
|
|
9
100
|
<body>
|
|
10
101
|
</body>
|
|
11
|
-
</html>`
|
|
102
|
+
</html>`
|
|
103
|
+
);
|
|
104
|
+
r.provide("devServerHtml", e);
|
|
105
|
+
}
|
|
106
|
+
function p(r, o) {
|
|
107
|
+
const e = o.resolvedUrls, t = e?.local.at(0) ?? e?.network.at(0);
|
|
108
|
+
if (t === void 0)
|
|
109
|
+
throw new Error("Failed to resolve the dev server URL");
|
|
110
|
+
r.provide("devServerUrl", t);
|
|
111
|
+
}
|
|
112
|
+
export {
|
|
113
|
+
h as setup
|
|
114
|
+
};
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
export type
|
|
4
|
-
export
|
|
5
|
-
export {
|
|
6
|
-
export type {
|
|
7
|
-
export
|
|
8
|
-
export { setupPuppeteerTest } from "./vitest/setupFile";
|
|
1
|
+
import { PuppeteerMatchers } from './vitest/matchers';
|
|
2
|
+
export type * from './puppeteer/types';
|
|
3
|
+
export type { NewE2EPageOptions } from './puppeteer/page';
|
|
4
|
+
export { newE2EPage } from './puppeteer/page';
|
|
5
|
+
export type { E2EElement } from './puppeteer/element';
|
|
6
|
+
export type { EventSpy } from './puppeteer/events';
|
|
7
|
+
export { setupPuppeteerTest } from './vitest/setupFile';
|
|
9
8
|
declare module "vitest" {
|
|
10
9
|
interface Assertion<T = any> extends PuppeteerMatchers<T> {
|
|
11
10
|
}
|