@arcgis/lumina-compiler 4.34.0-next.4 → 4.34.0-next.40

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.
@@ -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
  /**
@@ -211,46 +211,31 @@ export type React18WrapperOptions = {
211
211
  /**
212
212
  * Options for externalizing dependencies.
213
213
  *
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
214
  * @remarks
221
215
  * If Vite is running under Storybook, these options are ignored. This is
222
216
  * because in Storybook build, unlike in a library build, we want to bundle in
223
217
  * all dependencies (with exception of @arcgis/core and web component
224
218
  * dependencies, which are loaded using the ESM CDN).
225
219
  */
226
- export type DependencyManagementOptions = Omit<RollupPluginNodeExternalsOptions, "exclude" | "include"> & {
220
+ export type DependencyManagementOptions = BaseDependencyManagementOptions & {
227
221
  /**
228
- * Force bundle in these dependencies even if they are declared as
229
- * dependencies or peerDependencies.
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:
222
+ * By default, Lumina will error if it encounters usage of an unknown custom
223
+ * element. This setting allows to silence such error if you are manually
224
+ * importing some custom elements.
236
225
  *
237
- * - If TypeScript types from the bundled in dependencies are referenced in
238
- * the `.d.ts` files of your library, you will need to declare the package
239
- * as a `dependency`, so that it is still installed on the consumer's
240
- * computer so that TypeScript can correctly resolve the types of that
241
- * library.
242
- */
243
- readonly bundleIn?: NonNullable<RollupPluginNodeExternalsOptions>["exclude"];
244
- /**
245
- * Force externalize these dependencies, even if they are declared as
246
- * devDependencies.
226
+ * > [!IMPORTANT]
227
+ * >
228
+ * > This option is an escape hatch. Build-time optimizations are not applied
229
+ * > to such custom elements. Additionally, you assume the responsibility for
230
+ * > correctly loading the web component in lazy, non-lazy and CDN builds.
247
231
  *
248
232
  * @example
249
- * This is desirable if you are sure the end user will have these dependencies
250
- * available, yet do not wish to declare these as devDependencies for some
251
- * technical reasons.
233
+ * ```ts
234
+ * // Silence errors for unknown custom elements that start with "fluent-"
235
+ * silenceUnknownJsxElementUsage: (tagName) => tagName.startsWith("fluent-")
236
+ * ```
252
237
  */
253
- readonly externalize?: NonNullable<RollupPluginNodeExternalsOptions>["include"];
238
+ readonly silenceUnknownJsxElementUsage?: (tagName: string, fileName: string, context: CompilerContext) => boolean;
254
239
  };
255
240
  export type ServeEnvironmentOptions = {
256
241
  /**
@@ -1,3 +1,3 @@
1
- import { SourceDescription } from 'rollup';
2
1
  import { CompilerContext } from '../context';
3
- export declare function injectRuntimeOptions(runtimeTsCode: string, context: CompilerContext): SourceDescription;
2
+ import { TransformResult } from 'vite';
3
+ export declare function injectRuntimeOptions(runtimeTsCode: string, context: CompilerContext): TransformResult;
@@ -1,5 +1,8 @@
1
- import { SourceMap } from 'rollup';
2
1
  import { default as ts } from 'typescript';
2
+ import { TransformResult } from 'vite';
3
+ type SourceMap = Extract<NonNullable<TransformResult["map"]>, {
4
+ file: string;
5
+ }>;
3
6
  export type UndocumentedTypeScript = {
4
7
  readonly createSourceMapGenerator?: (host: ts.CompilerHost, basename: string, sourceRoot: string, dirname: string, compilerOptions: ts.CompilerOptions) => SourceMapGenerator;
5
8
  readonly createTextWriter?: (newLine: string) => EmitTextWriter;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/lumina-compiler",
3
- "version": "4.34.0-next.4",
3
+ "version": "4.34.0-next.40",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -18,16 +18,14 @@
18
18
  ],
19
19
  "license": "SEE LICENSE IN LICENSE.md",
20
20
  "dependencies": {
21
- "@arcgis/api-extractor": "4.34.0-next.4",
22
- "@arcgis/components-build-utils": "4.34.0-next.4",
23
- "@arcgis/components-utils": "4.34.0-next.4",
21
+ "@arcgis/api-extractor": "4.34.0-next.40",
22
+ "@arcgis/components-build-utils": "4.34.0-next.40",
23
+ "@arcgis/components-utils": "4.34.0-next.40",
24
24
  "chalk": "^5.3.0",
25
25
  "esbuild": "^0.25.4",
26
26
  "glob": "^11.0.0",
27
27
  "js-beautify": "^1.15.1",
28
28
  "mime-types": "^2.1.35",
29
- "rollup": "^4.40.2",
30
- "rollup-plugin-node-externals": "^8.0.0",
31
29
  "sass-embedded": "^1.79.3",
32
30
  "tslib": "^2.8.1",
33
31
  "typescript": "~5.8.3",
@@ -37,6 +35,6 @@
37
35
  "vitest-fail-on-console": "^0.7.1"
38
36
  },
39
37
  "peerDependencies": {
40
- "@arcgis/lumina": "~4.34.0-next.4"
38
+ "@arcgis/lumina": "~4.34.0-next.40"
41
39
  }
42
40
  }
@@ -1,45 +0,0 @@
1
- /**
2
- * This file is a workaround for a TypeScript bug:
3
- * https://github.com/microsoft/TypeScript/issues/59150
4
- *
5
- * Once that bug is fixed, the code can be simplified like so:
6
- * - This file can be removed
7
- * - For each place where `escapeBackticks` or `escapeForTemplateLiteral` was
8
- * used and the result was passed as the 1st AND 2nd parameter to one of
9
- * ts.factory.createNoSubstitutionTemplateLiteral,
10
- * ts.factory.createTemplateHead, ts.factory.createTemplateMiddle, or
11
- * ts.factory.createTemplateTail, change those places like so:
12
- * - DO NOT call `escapeBackticks` or `escapeForTemplateLiteral` anymore -
13
- * pass the value as is.
14
- * - DO NOT provide the 2nd parameter to the factory function.
15
- * - If `escapeForTemplateLiteral` was used in some other place, it can
16
- * potentially be replaced with a function like this:
17
- * string=>escapeTemplateSubstitution(string).replaceAll('`','\`')
18
- * (where escapeTemplateSubstitution is defined in the current file - move it)
19
- *
20
- * More details:
21
- *
22
- * In template literals, even though we *really* only need to escape ${ and
23
- * backticks, we are escaping non-ASCII characters too as that improves scanner
24
- * performance in JavaScript engines.
25
- *
26
- * This is what esbuild does (https://esbuild.github.io/api/#charset), what
27
- * V8 recommends (https://v8.dev/blog/scanner) and what TypeScript does.
28
- *
29
- * The code in this file has been copied from TypeScript's code for escaping
30
- * template literals (but simplified to remove dead branches and fix eslint
31
- * warnings):
32
- * https://github.com/microsoft/TypeScript/blob/3163fe7e3898c1f48cd9bc097b96e3426cd2a453/src/compiler/utilities.ts#L5918-L5986
33
- *
34
- * TypeScript can automatically escape template literals for us, but we opt out
35
- * of that as, due to a bug, they also escape new line characters which is not
36
- * good as it decreases readability when debugging code.
37
- *
38
- * TypeScript does not expose the template literal escaping utils so we had
39
- * to copy the code here, but modify to not escape new lines.
40
- *
41
- */
42
- declare function escapeNonAsciiString(s: string): string;
43
- export declare const escapeBackticks: typeof escapeNonAsciiString;
44
- export declare const escapeTemplateSubstitution: (str: string) => string;
45
- export {};