@arcgis/lumina-compiler 4.33.0-next.29 → 4.33.0-next.30
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/index.js +75 -73
- package/dist/plugins/buildCdn.d.ts +70 -4
- package/package.json +5 -5
|
@@ -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 {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcgis/lumina-compiler",
|
|
3
|
-
"version": "4.33.0-next.
|
|
3
|
+
"version": "4.33.0-next.30",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
],
|
|
19
19
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@arcgis/api-extractor": "4.33.0-next.
|
|
22
|
-
"@arcgis/components-build-utils": "4.33.0-next.
|
|
23
|
-
"@arcgis/components-utils": "4.33.0-next.
|
|
21
|
+
"@arcgis/api-extractor": "4.33.0-next.30",
|
|
22
|
+
"@arcgis/components-build-utils": "4.33.0-next.30",
|
|
23
|
+
"@arcgis/components-utils": "4.33.0-next.30",
|
|
24
24
|
"chalk": "^5.3.0",
|
|
25
25
|
"esbuild": "^0.24.0",
|
|
26
26
|
"js-beautify": "^1.15.1",
|
|
@@ -36,6 +36,6 @@
|
|
|
36
36
|
"vitest-fail-on-console": "^0.7.1"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
|
-
"@arcgis/lumina": "~4.33.0-next.
|
|
39
|
+
"@arcgis/lumina": "~4.33.0-next.30"
|
|
40
40
|
}
|
|
41
41
|
}
|