@arcgis/lumina-compiler 4.31.0-next.100
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 +13 -0
- package/README.md +21 -0
- package/dist/chunk-BQ4U6HQL.js +1 -0
- package/dist/chunk-JFKSI6I7.js +1 -0
- package/dist/context/index.d.ts +241 -0
- package/dist/context/types.d.ts +34 -0
- package/dist/context/utils.d.ts +23 -0
- package/dist/context/utils.spec.d.ts +1 -0
- package/dist/defaultAssetsUrl.d.ts +21 -0
- package/dist/defaultAssetsUrl.spec.d.ts +1 -0
- package/dist/dependencies/arcgisCore.d.ts +30 -0
- package/dist/dependencies/discover.d.ts +62 -0
- package/dist/dependencies/index.d.ts +11 -0
- package/dist/dependencies/lit.d.ts +2 -0
- package/dist/dependencies/loaders.d.ts +8 -0
- package/dist/dependencies/stencil.d.ts +6 -0
- package/dist/dependencies/testSetupFiles.d.ts +21 -0
- package/dist/dependencies/updateLumina.d.ts +8 -0
- package/dist/dependencies/updateLumina.spec.d.ts +1 -0
- package/dist/dependencies/utils.d.ts +23 -0
- package/dist/entrypoints/addNonLazyImports.d.ts +13 -0
- package/dist/entrypoints/config.d.ts +23 -0
- package/dist/entrypoints/dtsUtils.d.ts +22 -0
- package/dist/entrypoints/dtsUtils.spec.d.ts +1 -0
- package/dist/entrypoints/findUtils.d.ts +21 -0
- package/dist/entrypoints/findUtils.spec.d.ts +1 -0
- package/dist/entrypoints/handleComponentImports.d.ts +13 -0
- package/dist/entrypoints/pathMapping.d.ts +25 -0
- package/dist/entrypoints/resolveTagName.d.ts +14 -0
- package/dist/entrypoints/resolveTagName.spec.d.ts +1 -0
- package/dist/frameworkTypes/index.d.ts +15 -0
- package/dist/frameworkTypes/lumina.d.ts +5 -0
- package/dist/frameworkTypes/preact.d.ts +6 -0
- package/dist/frameworkTypes/react.d.ts +6 -0
- package/dist/frameworkTypes/stencil.d.ts +5 -0
- package/dist/frameworkTypes/utils.d.ts +8 -0
- package/dist/frameworkTypes/vanilla.d.ts +3 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.js +248 -0
- package/dist/jsxToLitHtml/autoAddNothing.d.ts +8 -0
- package/dist/jsxToLitHtml/comments.d.ts +19 -0
- package/dist/jsxToLitHtml/config.d.ts +148 -0
- package/dist/jsxToLitHtml/convertProps.d.ts +10 -0
- package/dist/jsxToLitHtml/escapeForTemplateLiteral.d.ts +45 -0
- package/dist/jsxToLitHtml/imports.d.ts +32 -0
- package/dist/jsxToLitHtml/index.d.ts +17 -0
- package/dist/jsxToLitHtml/inferPropType.d.ts +40 -0
- package/dist/jsxToLitHtml/insertRepeatCall.d.ts +49 -0
- package/dist/jsxToLitHtml/jsxVisitor.d.ts +11 -0
- package/dist/jsxToLitHtml/templateParts.d.ts +17 -0
- package/dist/jsxToLitHtml/throwOnImportingExternalized.d.ts +10 -0
- package/dist/jsxToLitHtml/types.d.ts +80 -0
- package/dist/jsxToLitHtml/utils.d.ts +14 -0
- package/dist/jsxToLitHtml/utils.spec.d.ts +1 -0
- package/dist/manifests/complexTypes/addComponentMetadata.d.ts +5 -0
- package/dist/manifests/complexTypes/addMethodMetadata.d.ts +6 -0
- package/dist/manifests/complexTypes/addPropMetadata.d.ts +8 -0
- package/dist/manifests/complexTypes/docsUtils.d.ts +18 -0
- package/dist/manifests/complexTypes/event.d.ts +9 -0
- package/dist/manifests/complexTypes/getComplexPropertyType.d.ts +11 -0
- package/dist/manifests/complexTypes/transformUtils.d.ts +130 -0
- package/dist/manifests/complexTypes/transformUtils.spec.d.ts +1 -0
- package/dist/manifests/complexTypes/typeToEnum.d.ts +14 -0
- package/dist/manifests/complexTypes/typeToEnum.spec.d.ts +1 -0
- package/dist/manifests/complexTypes/types.d.ts +135 -0
- package/dist/manifests/config.d.ts +2 -0
- package/dist/manifests/createManifest.d.ts +39 -0
- package/dist/manifests/customElementDecoratorPlugins.d.ts +58 -0
- package/dist/manifests/customElementDecoratorPlugins.spec.d.ts +1 -0
- package/dist/manifests/hideUntilHydrated.d.ts +15 -0
- package/dist/manifests/index.d.ts +12 -0
- package/dist/manifests/kebabCaseAttributes.d.ts +18 -0
- package/dist/manifests/lazy.d.ts +22 -0
- package/dist/manifests/lazy.spec.d.ts +1 -0
- package/dist/manifests/stencilManifest.d.ts +17 -0
- package/dist/manifests/storybookManifest.d.ts +6 -0
- package/dist/manifests/types.d.ts +1 -0
- package/dist/manifests/utils.d.ts +17 -0
- package/dist/plugins/buildCdn.d.ts +14 -0
- package/dist/plugins/buildStencilHydrate.d.ts +16 -0
- package/dist/plugins/buildWrappers.d.ts +3 -0
- package/dist/plugins/configureVite.d.ts +19 -0
- package/dist/plugins/externalizeDependencies.d.ts +34 -0
- package/dist/plugins/externalizeDependencies.spec.d.ts +1 -0
- package/dist/plugins/generateDocs.d.ts +10 -0
- package/dist/plugins/handleDynamicAssets.d.ts +3 -0
- package/dist/plugins/handleStaticAssets.d.ts +9 -0
- package/dist/plugins/loadLitCss.d.ts +89 -0
- package/dist/plugins/printTotalBuildSize.d.ts +7 -0
- package/dist/plugins/provideAssets.d.ts +53 -0
- package/dist/plugins/provideAssets.spec.d.ts +1 -0
- package/dist/plugins/setAssetsPath.d.ts +10 -0
- package/dist/plugins/updatePackageJson.d.ts +9 -0
- package/dist/plugins/updatePackageJson.spec.d.ts +1 -0
- package/dist/publicTypes.d.ts +626 -0
- package/dist/puppeteer-testing/globalSetup.d.ts +72 -0
- package/dist/puppeteer-testing/globalSetup.js +11 -0
- package/dist/puppeteer-testing/index.d.ts +9 -0
- package/dist/puppeteer-testing/index.js +6 -0
- package/dist/puppeteer-testing/injected.d.ts +8 -0
- package/dist/puppeteer-testing/puppeteer/browser.d.ts +6 -0
- package/dist/puppeteer-testing/puppeteer/element.d.ts +219 -0
- package/dist/puppeteer-testing/puppeteer/events.d.ts +21 -0
- package/dist/puppeteer-testing/puppeteer/page.d.ts +5 -0
- package/dist/puppeteer-testing/puppeteer/types.d.ts +124 -0
- package/dist/puppeteer-testing/vitest/matchers/attributes.d.ts +4 -0
- package/dist/puppeteer-testing/vitest/matchers/classList.d.ts +4 -0
- package/dist/puppeteer-testing/vitest/matchers/events.d.ts +7 -0
- package/dist/puppeteer-testing/vitest/matchers/index.d.ts +38 -0
- package/dist/puppeteer-testing/vitest/matchers/text.d.ts +2 -0
- package/dist/puppeteer-testing/vitest/matchers/utils.d.ts +1 -0
- package/dist/puppeteer-testing/vitest/runner.d.ts +15 -0
- package/dist/puppeteer-testing/vitest/setupFile.d.ts +1 -0
- package/dist/testing/index.d.ts +11 -0
- package/dist/testing/index.js +1 -0
- package/dist/testing/mount.d.ts +106 -0
- package/dist/testing/setupFile.d.ts +1 -0
- package/dist/testing/snapshotSerializer.d.ts +12 -0
- package/dist/testing/wrapController.d.ts +33 -0
- package/dist/tests/utils.d.ts +4 -0
- package/dist/transformers/guardAgainstInternalJsDoc.d.ts +11 -0
- package/dist/transformers/index.d.ts +22 -0
- package/dist/transformers/injectRuntimeOptions.d.ts +3 -0
- package/dist/transformers/internalTypeScriptApis.d.ts +29 -0
- package/dist/transformers/liftDecorators.d.ts +21 -0
- package/dist/transformers/members.d.ts +12 -0
- package/dist/transformers/property.d.ts +9 -0
- package/dist/transformers/propertyOptions.d.ts +111 -0
- package/dist/transformers/updateOriginalFile.d.ts +20 -0
- package/dist/transformers/utils.d.ts +14 -0
- package/dist/types/astTransformers.d.ts +3 -0
- package/dist/types/hideInternalLitElement.d.ts +9 -0
- package/dist/types/index.d.ts +18 -0
- package/dist/types/liftSetterTypes.d.ts +33 -0
- package/dist/types/textTransformers.d.ts +4 -0
- package/dist/types/transformComponentMembers.d.ts +10 -0
- package/dist/useLumina.d.ts +13 -0
- package/dist/utils/error.d.ts +4 -0
- package/dist/utils/packageJson.d.ts +24 -0
- package/dist/utils/path.d.ts +25 -0
- package/dist/utils/path.spec.d.ts +1 -0
- package/package.json +80 -0
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file has a companion `@arcgis/lumina/typings/loadLitCss.d.ts`. Edits
|
|
3
|
+
* to this file may need to be reflected there too
|
|
4
|
+
*/
|
|
5
|
+
import type { Plugin } from "vite";
|
|
6
|
+
import type { CompilerContext } from "../context";
|
|
7
|
+
/**
|
|
8
|
+
* The `.adoptedStyleSheets` API is very convenient, but it has one issue: it
|
|
9
|
+
* has higher precedence order than the `<link>` or `<style>` tags. This API was
|
|
10
|
+
* designed with apps in mind, not libraries.
|
|
11
|
+
*
|
|
12
|
+
* As a workaround, we are wrapping the CSS in a `@layer {}` syntax to reduce
|
|
13
|
+
* it's precedence.
|
|
14
|
+
*
|
|
15
|
+
* More information:
|
|
16
|
+
* https://discord.com/channels/1012791295170859069/1274527043614150708
|
|
17
|
+
*/
|
|
18
|
+
export declare const layeredCssFlag = "?layered";
|
|
19
|
+
/**
|
|
20
|
+
* During build, we insert a side-effect import into the loader.ts file purely
|
|
21
|
+
* so that the transform() is triggered for that file so that we can piggy back
|
|
22
|
+
* on the transformed output (and create a separate .css file out of it). We do
|
|
23
|
+
* not intend for such file to be included in the JS bundle in the NPM build.
|
|
24
|
+
* Such import will be dropped by the minifier.
|
|
25
|
+
*
|
|
26
|
+
* It's a bit hacky, but that is needed to workaround this Vite behavior:
|
|
27
|
+
* 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
|
|
28
|
+
*/
|
|
29
|
+
export declare const globalCssFlag = "?global";
|
|
30
|
+
/**
|
|
31
|
+
* Given a CSS file like:
|
|
32
|
+
*
|
|
33
|
+
* ```css
|
|
34
|
+
* // counter.css
|
|
35
|
+
* :host {
|
|
36
|
+
* display: flex;
|
|
37
|
+
* gap: 1rem;
|
|
38
|
+
* }
|
|
39
|
+
* button {
|
|
40
|
+
* padding: 1rem;
|
|
41
|
+
* }
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* and an import like this:
|
|
45
|
+
*
|
|
46
|
+
* ```ts
|
|
47
|
+
* import styles from './counter.css';
|
|
48
|
+
* export class ArcgisCounter extends LitElement {
|
|
49
|
+
* static override styles = [styles];
|
|
50
|
+
* }
|
|
51
|
+
* ```
|
|
52
|
+
*
|
|
53
|
+
* This plugin will tell Vite to inline the css file (rather than produce a
|
|
54
|
+
* separate asset). Vite transformer will transform the css file into this:
|
|
55
|
+
*
|
|
56
|
+
* ```js
|
|
57
|
+
* export default ":host{display:flex;gap:1rem}button{padding:1rem}"
|
|
58
|
+
* ```
|
|
59
|
+
*
|
|
60
|
+
* Then, we augment it into this:
|
|
61
|
+
* ```js
|
|
62
|
+
* import { css } from 'lit';
|
|
63
|
+
* const styles = css`:host{display:flex;gap:1rem}button{padding:1rem}`;
|
|
64
|
+
* export default styles;
|
|
65
|
+
* ```
|
|
66
|
+
*
|
|
67
|
+
* The Lumina runtime later loads it like this:
|
|
68
|
+
*
|
|
69
|
+
* ```js
|
|
70
|
+
* host.adoptedStyleSheets = [...document.adoptedStyleSheets, styles.styleSheet];
|
|
71
|
+
* // Host is the shadow root of the component for shadow root components. Host
|
|
72
|
+
* // is the document for non-shadow root components or global styles.
|
|
73
|
+
* ```
|
|
74
|
+
*
|
|
75
|
+
* @remarks
|
|
76
|
+
* We inline the css rather than produce a separate asset because:
|
|
77
|
+
* - Loading assets adds complexity:
|
|
78
|
+
* - need to call getAssetPath() to get correct asset location
|
|
79
|
+
* (can't do that easily in a .css file)
|
|
80
|
+
* - the consuming application might not have had the chance to call
|
|
81
|
+
* setAssetPath() yet when getAssetPath() is called by us
|
|
82
|
+
* - the network request might fail
|
|
83
|
+
* - Loading assets creates "a flash of unstyled content" issue (i.e font
|
|
84
|
+
* changing after being loaded)
|
|
85
|
+
*
|
|
86
|
+
* Same goes for assets references inside the css file (icons and fonts) - they
|
|
87
|
+
* will be inlined as base64 to simplify our life.
|
|
88
|
+
*/
|
|
89
|
+
export declare const loadLitCss: (context: CompilerContext) => Plugin;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Plugin } from "vite";
|
|
2
|
+
import type { CompilerContext } from "../context";
|
|
3
|
+
/**
|
|
4
|
+
* Augmenting vite's default reporter to not just report bundle sizes, but to
|
|
5
|
+
* also print the total size
|
|
6
|
+
*/
|
|
7
|
+
export declare const printTotalBuildSize: (context: CompilerContext) => Plugin;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utilities for making Vite copy assets to the output folder during build or
|
|
3
|
+
* serve them when in serve mode
|
|
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";
|
|
21
|
+
export declare function serveAssets(context: CompilerContext, assets: AssetSpec[], transformers?: AssetTransformer[]): void;
|
|
22
|
+
export declare function writeAssets(context: CompilerContext, assets: AssetSpec[], transformers?: AssetTransformer[]): Promise<void>;
|
|
23
|
+
/**
|
|
24
|
+
* If trying to serve a file and destination does not include file name, take
|
|
25
|
+
* file name from source
|
|
26
|
+
*/
|
|
27
|
+
declare function addImplicitDistFileName(spec: AssetSpec): string;
|
|
28
|
+
/**
|
|
29
|
+
* Taking an absolute or relative destination path, resolve it as follows:
|
|
30
|
+
* - Make absolute path be relative to the output base
|
|
31
|
+
* - Prepend relative path with the serve base
|
|
32
|
+
* - Ensure the resulting path does not escape above the output directory
|
|
33
|
+
* - Ensure the path separators are correct for the current system
|
|
34
|
+
*/
|
|
35
|
+
declare function resolveDistPath({ dist, distCdnAssets }: Pick<ContextDirectories, "dist" | "distCdnAssets">, rawDestination: string): string;
|
|
36
|
+
/**
|
|
37
|
+
* Take a resolved absolute file path in the dist directory, and from it infer
|
|
38
|
+
* the path at which the file will be served.
|
|
39
|
+
*/
|
|
40
|
+
declare function resolveServePath(baseUrl: string, resolvedDistPath: string, distCdnDir: string): string;
|
|
41
|
+
/**
|
|
42
|
+
* Given an array of absolute paths, make sure a parent directory for each file
|
|
43
|
+
* exists
|
|
44
|
+
*/
|
|
45
|
+
export declare function makeDirectoriesForFiles(files: readonly string[]): Promise<void>;
|
|
46
|
+
export declare const minifyJsonTransformer: AssetTransformer;
|
|
47
|
+
export declare const defaultAssetTransformers: AssetTransformer[];
|
|
48
|
+
export declare const exportsForTests: {
|
|
49
|
+
addImplicitDistFileName: typeof addImplicitDistFileName;
|
|
50
|
+
resolveDistPath: typeof resolveDistPath;
|
|
51
|
+
resolveServePath: typeof resolveServePath;
|
|
52
|
+
};
|
|
53
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Plugin } from "vite";
|
|
2
|
+
import type { CompilerContext } from "../context";
|
|
3
|
+
/**
|
|
4
|
+
* Plugin to set the base URL for assets in the package
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* In `@arcgis/storybook-utils` this plugin is removed so that the original
|
|
8
|
+
* base URL is used (./)
|
|
9
|
+
*/
|
|
10
|
+
export declare const setAssetPath: (context: CompilerContext) => Plugin;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { MiniPackageJson } from "../utils/packageJson";
|
|
2
|
+
import type { CompilerContext } from "../context";
|
|
3
|
+
import type { Plugin } from "vite";
|
|
4
|
+
export declare const updatePackageJson: (context: CompilerContext) => Plugin;
|
|
5
|
+
declare function doPackageJsonUpdate(packageJson: MiniPackageJson, context: Pick<CompilerContext, "dir" | "documentationFileNames">): MiniPackageJson | undefined;
|
|
6
|
+
export declare const exportsForTests: {
|
|
7
|
+
doPackageJsonUpdate: typeof doPackageJsonUpdate;
|
|
8
|
+
};
|
|
9
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|