@arcgis/core-adapter 4.32.0-next.4 → 4.32.0-next.41
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/.turbo/turbo-build.log +16 -3
- package/dist/index.cjs +747 -174
- package/dist/index.d.cts +108 -38
- package/dist/index.d.ts +108 -38
- package/dist/index.js +670 -167
- package/package.json +4 -28
- package/scripts/generator.ts +18 -1
- package/scripts/update-adapter-typings.ts +49 -15
- package/src/index.ts +673 -170
- package/support/api-reference-esm-imports.json +63 -13
- package/support/arcgis.d.ts +47376 -51136
- package/support/publicModules.ts +25 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcgis/core-adapter",
|
|
3
|
-
"version": "4.32.0-next.
|
|
3
|
+
"version": "4.32.0-next.41",
|
|
4
4
|
"description": "ArcGIS Core Adapter",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -13,35 +13,11 @@
|
|
|
13
13
|
"require": "./dist/index.cjs"
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
|
-
"publishConfig": {
|
|
17
|
-
"registry": "https://registry.npmjs.org/",
|
|
18
|
-
"access": "public"
|
|
19
|
-
},
|
|
20
16
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
21
|
-
"scripts": {
|
|
22
|
-
"build": "yarn pre:build && yarn build:generate && yarn build:tsup",
|
|
23
|
-
"build:dev": "yarn build",
|
|
24
|
-
"build:generate": "tsx ./scripts/generator.ts",
|
|
25
|
-
"build:tsup": "tsup --silent",
|
|
26
|
-
"pre:build": "rimraf ./src/index.ts",
|
|
27
|
-
"clean": "rimraf .turbo ./dist",
|
|
28
|
-
"update-types": "tsx ./scripts/update-adapter-typings"
|
|
29
|
-
},
|
|
30
17
|
"dependencies": {
|
|
31
18
|
"tslib": "^2.7.0"
|
|
32
19
|
},
|
|
33
|
-
"devDependencies": {
|
|
34
|
-
"@arcgis/typescript-config": "4.32.0-next.4",
|
|
35
|
-
"@types/node": "^20.2.5",
|
|
36
|
-
"resolve-pkg": "^2.0.0",
|
|
37
|
-
"rimraf": "^5.0.0",
|
|
38
|
-
"ts-morph": "^22.0.0",
|
|
39
|
-
"tsup": "^8.3.0",
|
|
40
|
-
"tsx": "^4.19.0",
|
|
41
|
-
"typescript": "~5.4.0"
|
|
42
|
-
},
|
|
43
20
|
"peerDependencies": {
|
|
44
|
-
"@arcgis/core": ">=4.
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
}
|
|
21
|
+
"@arcgis/core": ">=4.32.0-next <4.33"
|
|
22
|
+
}
|
|
23
|
+
}
|
package/scripts/generator.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import fs from "fs";
|
|
2
2
|
import path from "path";
|
|
3
|
-
import ts from "typescript";
|
|
4
3
|
import resolvePkg from "resolve-pkg";
|
|
5
4
|
import type { SourceFile } from "ts-morph";
|
|
6
5
|
import { Project } from "ts-morph";
|
|
6
|
+
import ts from "typescript";
|
|
7
7
|
import { fileURLToPath } from "url";
|
|
8
|
+
import { publicModules } from "../support/publicModules";
|
|
8
9
|
|
|
9
10
|
const dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
10
11
|
|
|
@@ -165,6 +166,8 @@ function generate(): void {
|
|
|
165
166
|
|
|
166
167
|
const publicTypeValidator = new PublicTypeValidator();
|
|
167
168
|
|
|
169
|
+
const visitedModules = new Set<string>();
|
|
170
|
+
|
|
168
171
|
// We will visit the typings and extract the symbols we need
|
|
169
172
|
// Add the singletons to the typeInfos array
|
|
170
173
|
const typeInfos: TypeInfo[] = [...singletons.entries()].map(([amdModulePath, typeName]) => ({
|
|
@@ -189,10 +192,24 @@ function generate(): void {
|
|
|
189
192
|
// Only include imports that are in the import dictionary
|
|
190
193
|
// or are part of "esri/applications" modules
|
|
191
194
|
const amdModulePath = node.name.text;
|
|
195
|
+
if (visitedModules.has(amdModulePath)) {
|
|
196
|
+
console.log("\x1b[33m", "WARNING: Skipping duplicate module: ", amdModulePath);
|
|
197
|
+
return node;
|
|
198
|
+
}
|
|
199
|
+
visitedModules.add(amdModulePath);
|
|
192
200
|
if (!amdImportReferencesKeys.includes(amdModulePath) && !amdModulePath.includes("esri/applications")) {
|
|
193
201
|
return node;
|
|
194
202
|
}
|
|
195
203
|
|
|
204
|
+
if (amdModulePath.includes("esri/applications") && !publicModules.includes(amdModulePath)) {
|
|
205
|
+
console.log(
|
|
206
|
+
"\x1b[33m",
|
|
207
|
+
"WARNING: Skipping, application module not in publicModules file in js-api repo: ",
|
|
208
|
+
amdModulePath,
|
|
209
|
+
);
|
|
210
|
+
return node;
|
|
211
|
+
}
|
|
212
|
+
|
|
196
213
|
// Ignore modules that are in the ignore list and the singletons that are already in the typeInfos array
|
|
197
214
|
if (ignoreModule(amdModulePath) || singletons.has(amdModulePath)) {
|
|
198
215
|
return node;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import fs from "fs";
|
|
2
|
-
import https from "https";
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import https from "node:https";
|
|
3
3
|
import resolvePkg from "resolve-pkg";
|
|
4
4
|
|
|
5
5
|
// Get the @arcgis/core installed version
|
|
@@ -22,37 +22,71 @@ const files = [
|
|
|
22
22
|
source: `https://jsapi.esri.com/typings/api-reference-esm-imports-${coreVersion}.json`,
|
|
23
23
|
destination: `${process.cwd()}/support/api-reference-esm-imports.json`,
|
|
24
24
|
},
|
|
25
|
+
{
|
|
26
|
+
source: "https://raw.devtopia.esri.com/WebGIS/arcgis-js-api/4master/build/publicModules.mjs",
|
|
27
|
+
destination: `${process.cwd()}/support/publicModules.ts`,
|
|
28
|
+
},
|
|
25
29
|
];
|
|
26
30
|
|
|
31
|
+
const HttpOK = 200;
|
|
32
|
+
|
|
27
33
|
// Download the typings and support files.
|
|
28
34
|
async function downloadSupportFiles(source: string, destination: string): Promise<void> {
|
|
29
|
-
try {
|
|
30
|
-
fs.unlinkSync(destination);
|
|
31
|
-
} catch {
|
|
32
|
-
console.log("Error in deleting typings files, continue...");
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const file = fs.createWriteStream(destination);
|
|
36
|
-
|
|
37
35
|
await new Promise((resolve, reject) => {
|
|
38
|
-
|
|
36
|
+
const isPublicModules = source.includes("publicModules.mjs");
|
|
37
|
+
const options: {
|
|
38
|
+
headers?: {
|
|
39
|
+
Authorization: string;
|
|
40
|
+
};
|
|
41
|
+
} = {};
|
|
42
|
+
if (isPublicModules) {
|
|
43
|
+
options.headers = {
|
|
44
|
+
Authorization: `Token ${process.env.DEVTOPIA_TOKEN}`,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
https.get(source, options, (resp) => {
|
|
48
|
+
const file = resp.statusCode === HttpOK ? fs.createWriteStream(destination) : undefined;
|
|
39
49
|
console.log("Downloaded:", source);
|
|
40
50
|
console.log(`Response type: ${resp.headers["content-type"]}`);
|
|
41
51
|
|
|
42
|
-
resp.
|
|
52
|
+
if (resp.statusCode !== HttpOK) {
|
|
53
|
+
console.error(`Request failed for ${source}:`, resp.statusMessage);
|
|
54
|
+
console.error(`Skipping: ${destination}`);
|
|
55
|
+
file?.close();
|
|
56
|
+
resolve(undefined);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (isPublicModules) {
|
|
60
|
+
let body = "";
|
|
61
|
+
resp.on("data", (chunk) => {
|
|
62
|
+
body += chunk;
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
resp.on("end", () => {
|
|
66
|
+
const regex = /const\s+publicModules\s*=\s*\[(.*?)\];/su;
|
|
67
|
+
const match = body.match(regex);
|
|
68
|
+
if (match) {
|
|
69
|
+
const publicModules = match[1];
|
|
70
|
+
body = `export const publicModules = [${publicModules}];`;
|
|
71
|
+
file?.write(body);
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
} else {
|
|
75
|
+
resp.pipe(file!);
|
|
76
|
+
}
|
|
43
77
|
|
|
44
78
|
resp.on("error", (err) => {
|
|
45
79
|
console.error(`Request error for ${source}:`, err);
|
|
46
80
|
reject(err);
|
|
47
81
|
});
|
|
48
82
|
|
|
49
|
-
file
|
|
83
|
+
file?.on("error", (err) => {
|
|
50
84
|
console.error(`Writing error for ${destination}:`, err);
|
|
51
85
|
reject(err);
|
|
52
86
|
});
|
|
53
87
|
|
|
54
|
-
file
|
|
55
|
-
file
|
|
88
|
+
file?.on("finish", () => {
|
|
89
|
+
file?.close();
|
|
56
90
|
resolve(undefined);
|
|
57
91
|
});
|
|
58
92
|
});
|