1
1
/*eslint-env node*/
2
2
import { writeFileSync , copyFileSync , readFileSync , existsSync } from "fs" ;
3
3
import { readFile , writeFile } from "fs/promises" ;
4
- import {
5
- join ,
6
- basename ,
7
- relative ,
8
- extname ,
9
- resolve ,
10
- posix ,
11
- dirname ,
12
- } from "path" ;
4
+ import { join , basename , resolve , posix , dirname } from "path" ;
13
5
import { exec , execSync } from "child_process" ;
14
6
import { createHash } from "crypto" ;
15
7
import { gzipSync } from "zlib" ;
@@ -22,7 +14,7 @@ import gulpTap from "gulp-tap";
22
14
import gulpZip from "gulp-zip" ;
23
15
import gulpRename from "gulp-rename" ;
24
16
import gulpReplace from "gulp-replace" ;
25
- import { globby , globbySync } from "globby" ;
17
+ import { globby } from "globby" ;
26
18
import open from "open" ;
27
19
import rimraf from "rimraf" ;
28
20
import mkdirp from "mkdirp" ;
@@ -89,20 +81,6 @@ const sourceFiles = [
89
81
"!Source/ThirdParty/_*" ,
90
82
] ;
91
83
92
- const relativeWorkspaceSourceFiles = {
93
- engine : [
94
- "packages/engine/Source/**/*.js" ,
95
- "!packages/engine/Source/*.js" ,
96
- "!packages/engine/Source/Workers/**" ,
97
- "!packages/engine/Source/WorkersES6/**" ,
98
- "packages/engine/Source/WorkersES6/createTaskProcessorWorker.js" ,
99
- "!packages/engine/Source/ThirdParty/Workers/**" ,
100
- "!packages/engine/Source/ThirdParty/google-earth-dbroot-parser.js" ,
101
- "!packages/engine/Source/ThirdParty/_*" ,
102
- ] ,
103
- widgets : [ "packages/widgets/Source/**/*.js" ] ,
104
- } ;
105
-
106
84
const workerSourceFiles = [ "packages/engine/Source/WorkersES6/**" ] ;
107
85
const watchedSpecFiles = [
108
86
"Specs/**/*Spec.js" ,
@@ -1915,36 +1893,6 @@ ${source}
1915
1893
1916
1894
` ;
1917
1895
1918
- // Map individual modules back to their source file so that TS still works
1919
- // when importing individual files instead of the entire cesium module.
1920
-
1921
- globbySync ( relativeWorkspaceSourceFiles [ `engine` ] ) . forEach ( function ( file ) {
1922
- file = relative ( "packages/engine/Source" , file ) ;
1923
-
1924
- let moduleId = file ;
1925
- moduleId = filePathToModuleId ( moduleId ) ;
1926
-
1927
- const assignmentName = basename ( file , extname ( file ) ) ;
1928
-
1929
- if ( publicModules . has ( assignmentName ) ) {
1930
- publicModules . delete ( assignmentName ) ;
1931
- source += `declare module "${ scope } /packages/engine/Source/${ moduleId } " { import { ${ assignmentName } } from '@${ scope } /engine'; export default ${ assignmentName } ; }\n` ;
1932
- }
1933
- } ) ;
1934
-
1935
- globbySync ( relativeWorkspaceSourceFiles [ `widgets` ] ) . forEach ( function ( file ) {
1936
- file = relative ( "packages/widgets/Source" , file ) ;
1937
-
1938
- let moduleId = file ;
1939
- moduleId = filePathToModuleId ( moduleId ) ;
1940
-
1941
- const assignmentName = basename ( file , extname ( file ) ) ;
1942
- if ( publicModules . has ( assignmentName ) ) {
1943
- publicModules . delete ( assignmentName ) ;
1944
- source += `declare module "${ scope } /packages/widgets/Source/${ moduleId } " { import { ${ assignmentName } } from '@${ scope } /widgets'; export default ${ assignmentName } ; }\n` ;
1945
- }
1946
- } ) ;
1947
-
1948
1896
// Write the final source file back out
1949
1897
writeFileSync ( "Source/Cesium.d.ts" , source ) ;
1950
1898
@@ -1958,21 +1906,6 @@ ${source}
1958
1906
stdio : "inherit" ,
1959
1907
} ) ;
1960
1908
1961
- // Below is a sanity check to make sure we didn't leave anything out that
1962
- // we don't already know about
1963
-
1964
- // Intentionally ignored nested items
1965
- publicModules . delete ( "KmlFeatureData" ) ;
1966
- publicModules . delete ( "MaterialAppearance" ) ;
1967
-
1968
- if ( publicModules . size !== 0 ) {
1969
- throw new Error (
1970
- `Unexpected unexposed modules: ${ Array . from ( publicModules . values ( ) ) . join (
1971
- ", "
1972
- ) } `
1973
- ) ;
1974
- }
1975
-
1976
1909
return Promise . resolve ( ) ;
1977
1910
}
1978
1911
@@ -2276,7 +2209,3 @@ async function buildCesiumViewer() {
2276
2209
2277
2210
return streamToPromise ( stream . pipe ( gulp . dest ( cesiumViewerOutputDirectory ) ) ) ;
2278
2211
}
2279
-
2280
- function filePathToModuleId ( moduleId ) {
2281
- return moduleId . substring ( 0 , moduleId . lastIndexOf ( "." ) ) . replace ( / \\ / g, "/" ) ;
2282
- }
0 commit comments