Skip to content

Commit

Permalink
Change constructor type to primitive type for: Object, Number, String…
Browse files Browse the repository at this point in the history
…, Boolean; and standardize the generic syntax of Array and Promise
  • Loading branch information
wewindy committed Feb 10, 2023
1 parent 9ea3c9a commit 3d8f538
Show file tree
Hide file tree
Showing 731 changed files with 7,870 additions and 7,859 deletions.
4 changes: 2 additions & 2 deletions Apps/Sandcastle/gallery/Custom DataSource.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
* @alias WebGLGlobeDataSource
* @constructor
*
* @param {String} [name] The name of this data source. If undefined, a name
* @param {string} [name] The name of this data source. If undefined, a name
* will be derived from the url.
*
* @example
Expand Down Expand Up @@ -144,7 +144,7 @@
/**
* Gets the array of series names.
* @memberof WebGLGlobeDataSource.prototype
* @type {String[]}
* @type {}
*/
seriesNames: {
get: function () {
Expand Down
2 changes: 1 addition & 1 deletion Apps/Sandcastle/gallery/Custom Geocoder.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
/**
* The function called to geocode using this geocoder service.
*
* @param {String} input The query to be sent to the geocoder service
* @param {string} input The query to be sent to the geocoder service
* @returns {Promise<GeocoderService.Result[]>}
*/
OpenStreetMapNominatimGeocoder.prototype.geocode = function (input) {
Expand Down
146 changes: 73 additions & 73 deletions build.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,24 +144,24 @@ export async function getFilesFromWorkspaceGlobs(workspaceGlobs) {
}

/**
* @typedef {Object} CesiumBundles
* @property {Object} esmBundle The ESM bundle.
* @property {Object} iifeBundle The IIFE bundle, for use in browsers.
* @property {Object} nodeBundle The CommonJS bundle, for use in NodeJS.
* @typedef {object} CesiumBundles
* @property {object} esmBundle The ESM bundle.
* @property {object} iifeBundle The IIFE bundle, for use in browsers.
* @property {object} nodeBundle The CommonJS bundle, for use in NodeJS.
*/

/**
* Bundles all individual modules, optionally minifying and stripping out debug pragmas.
* @param {Object} options
* @param {String} options.path Directory where build artifacts are output
* @param {Boolean} [options.minify=false] true if the output should be minified
* @param {Boolean} [options.removePragmas=false] true if the output should have debug pragmas stripped out
* @param {Boolean} [options.sourcemap=false] true if an external sourcemap should be generated
* @param {Boolean} [options.iife=false] true if an IIFE style module should be built
* @param {Boolean} [options.node=false] true if a CJS style node module should be built
* @param {Boolean} [options.incremental=false] true if build output should be cached for repeated builds
* @param {Boolean} [options.write=true] true if build output should be written to disk. If false, the files that would have been written as in-memory buffers
* @returns {Promise.<CesiumBundles>}
* @param {object} options
* @param {string} options.path Directory where build artifacts are output
* @param {boolean} [options.minify=false] true if the output should be minified
* @param {boolean} [options.removePragmas=false] true if the output should have debug pragmas stripped out
* @param {boolean} [options.sourcemap=false] true if an external sourcemap should be generated
* @param {boolean} [options.iife=false] true if an IIFE style module should be built
* @param {boolean} [options.node=false] true if a CJS style node module should be built
* @param {boolean} [options.incremental=false] true if build output should be cached for repeated builds
* @param {boolean} [options.write=true] true if build output should be written to disk. If false, the files that would have been written as in-memory buffers
* @returns {Promise<CesiumBundles>}
*/
export async function bundleCesiumJs(options) {
const buildConfig = defaultESBuildOptions();
Expand Down Expand Up @@ -245,9 +245,9 @@ const workspaceSourceFiles = {
/**
* Generates export declaration from a file from a workspace.
*
* @param {String} workspace The workspace the file belongs to.
* @param {String} file The file.
* @returns {String} The export declaration.
* @param {string} workspace The workspace the file belongs to.
* @param {string} file The file.
* @returns {string} The export declaration.
*/
function generateDeclaration(workspace, file) {
let assignmentName = path.basename(file, path.extname(file));
Expand Down Expand Up @@ -319,11 +319,11 @@ function rollupWarning(message) {
}

/**
* @param {Object} options
* @param {object} options
* @param {boolean} [options.minify=false] true if the worker output should be minified
* @param {boolean} [options.removePragmas=false] true if debug pragma should be removed
* @param {boolean} [options.sourcemap=false] true if an external sourcemap should be generated
* @param {String} options.path output directory
* @param {string} options.path output directory
*/
export async function bundleCombinedWorkers(options) {
// Bundle non ES6 workers.
Expand Down Expand Up @@ -386,15 +386,15 @@ export async function bundleCombinedWorkers(options) {

/**
* Bundles the workers and outputs the result to the specified directory
* @param {Object} options
* @param {object} options
* @param {boolean} [options.minify=false] true if the worker output should be minified
* @param {boolean} [options.removePragmas=false] true if debug pragma should be removed
* @param {boolean} [options.sourcemap=false] true if an external sourcemap should be generated
* @param {Array.<String>} options.input The worker globs.
* @param {Array.<String>} options.inputES6 The ES6 worker globs.
* @param {String} options.path output directory
* @param {String} options.copyrightHeader The copyright header to add to worker bundles
* @returns {Promise.<*>}
* @param {string[]} options.input The worker globs.
* @param {string[]} options.inputES6 The ES6 worker globs.
* @param {string} options.path output directory
* @param {string} options.copyrightHeader The copyright header to add to worker bundles
* @returns {Promise<any>}
*/
export async function bundleWorkers(options) {
// Copy existing workers
Expand Down Expand Up @@ -621,8 +621,8 @@ const externalResolvePlugin = {

/**
* Creates a template html file in the Sandcastle app listing the gallery of demos
* @param {Boolean} [noDevelopmentGallery=false] true if the development gallery should not be included in the list
* @returns {Promise.<*>}
* @param {boolean} [noDevelopmentGallery=false] true if the development gallery should not be included in the list
* @returns {Promise<any>}
*/
export async function createGalleryList(noDevelopmentGallery) {
const demoObjects = [];
Expand Down Expand Up @@ -721,10 +721,10 @@ const has_new_gallery_demos = ${newDemos.length > 0 ? "true;" : "false;"}\n`;
/**
* Helper function to copy files.
*
* @param {Array.<String>} globs The file globs to be copied.
* @param {String} destination The path to copy the files to.
* @param {String} base The base path to omit from the globs when files are copied. Defaults to "".
* @returns {Promise.<Buffer>} A promise containing the stream output as a buffer.
* @param {Array.>} globs The file globs to be copied.
* @param {string} destination The path to copy the files to.
* @param {string} base The base path to omit from the globs when files are copied. Defaults to "".
* @returns {Promise<Buffer>} A promise containing the stream output as a buffer.
*/
export async function copyFiles(globs, destination, base) {
const stream = gulp
Expand All @@ -737,8 +737,8 @@ export async function copyFiles(globs, destination, base) {
/**
* Copy assets from engine.
*
* @param {String} destination The path to copy files to.
* @returns {Promise.<>} A promise that completes when all assets are copied to the destination.
* @param {string} destination The path to copy files to.
* @returns {Promise<void>} A promise that completes when all assets are copied to the destination.
*/
export async function copyEngineAssets(destination) {
const engineStaticAssets = [
Expand All @@ -765,8 +765,8 @@ export async function copyEngineAssets(destination) {
/**
* Copy assets from widgets.
*
* @param {String} destination The path to copy files to.
* @returns {Promise.<>} A promise that completes when all assets are copied to the destination.
* @param {string} destination The path to copy files to.
* @returns {Promise<void>} A promise that completes when all assets are copied to the destination.
*/
export async function copyWidgetsAssets(destination) {
const widgetsStaticAssets = [
Expand Down Expand Up @@ -805,10 +805,10 @@ export async function createJsHintOptions() {

/**
* Bundles spec files for testing in the browser and on the command line with karma.
* @param {Object} options
* @param {Boolean} [options.incremental=false] true if the build should be cached for repeated rebuilds
* @param {Boolean} [options.write=false] true if build output should be written to disk. If false, the files that would have been written as in-memory buffers
* @returns {Promise.<*>}
* @param {object} options
* @param {boolean} [options.incremental=false] true if the build should be cached for repeated rebuilds
* @param {boolean} [options.write=false] true if build output should be written to disk. If false, the files that would have been written as in-memory buffers
* @returns {Promise<any>}
*/
export function bundleCombinedSpecs(options) {
options = options || {};
Expand All @@ -834,7 +834,7 @@ export function bundleCombinedSpecs(options) {
/**
* Creates the index.js for a package.
*
* @param {String} workspace The workspace to create the index.js for.
* @param {string} workspace The workspace to create the index.js for.
* @returns
*/
async function createIndexJs(workspace) {
Expand Down Expand Up @@ -873,9 +873,9 @@ async function createIndexJs(workspace) {

/**
* Creates a single entry point file by importing all individual spec files.
* @param {Array.<String>} files The individual spec files.
* @param {String} workspace The workspace.
* @param {String} outputPath The path the file is written to.
* @param {Array.>} files The individual spec files.
* @param {string} workspace The workspace.
* @param {string} outputPath The path the file is written to.
*/
async function createSpecListForWorkspace(files, workspace, outputPath) {
let contents = "";
Expand All @@ -896,12 +896,12 @@ async function createSpecListForWorkspace(files, workspace, outputPath) {
/**
* Bundles CSS files.
*
* @param {Object} options
* @param {Array.<String>} options.filePaths The file paths to bundle.
* @param {Boolean} options.sourcemap
* @param {Boolean} options.minify
* @param {String} options.outdir The output directory.
* @param {String} options.outbase The
* @param {object} options
* @param {Array.>} options.filePaths The file paths to bundle.
* @param {boolean} options.sourcemap
* @param {boolean} options.minify
* @param {string} options.outdir The output directory.
* @param {string} options.outbase The
*/
async function bundleCSS(options) {
// Configure options for esbuild.
Expand All @@ -927,13 +927,13 @@ const workspaceCssFiles = {
/**
* Bundles spec files for testing in the browser.
*
* @param {Object} options
* @param {Boolean} [options.incremental=false] True if builds should be generated incrementally.
* @param {String} options.outbase The base path the output files are relative to.
* @param {String} options.outdir The directory to place the output in.
* @param {String} options.specListFile The path to the SpecList.js file
* @param {Boolean} [options.write=true] True if bundles generated are written to files instead of in-memory buffers.
* @returns {Object} The bundle generated from Specs.
* @param {object} options
* @param {boolean} [options.incremental=false] True if builds should be generated incrementally.
* @param {string} options.outbase The base path the output files are relative to.
* @param {string} options.outdir The directory to place the output in.
* @param {string} options.specListFile The path to the SpecList.js file
* @param {boolean} [options.write=true] True if bundles generated are written to files instead of in-memory buffers.
* @returns {object} The bundle generated from Specs.
*/
async function bundleSpecs(options) {
const incremental = options.incremental ?? true;
Expand Down Expand Up @@ -967,10 +967,10 @@ async function bundleSpecs(options) {
/**
* Builds the engine workspace.
*
* @param {Object} options
* @param {Boolean} [options.incremental=false] True if builds should be generated incrementally.
* @param {Boolean} [options.minify=false] True if bundles should be minified.
* @param {Boolean} [options.write=true] True if bundles generated are written to files instead of in-memory buffers.
* @param {object} options
* @param {boolean} [options.incremental=false] True if builds should be generated incrementally.
* @param {boolean} [options.minify=false] True if bundles should be minified.
* @param {boolean} [options.write=true] True if bundles generated are written to files instead of in-memory buffers.
*/
export const buildEngine = async (options) => {
options = options || {};
Expand Down Expand Up @@ -1018,9 +1018,9 @@ export const buildEngine = async (options) => {
/**
* Builds the widgets workspace.
*
* @param {Object} options
* @param {Boolean} [options.incremental=false] True if builds should be generated incrementally.
* @param {Boolean} [options.write=true] True if bundles generated are written to files instead of in-memory buffers.
* @param {object} options
* @param {boolean} [options.incremental=false] True if builds should be generated incrementally.
* @param {boolean} [options.write=true] True if bundles generated are written to files instead of in-memory buffers.
*/
export const buildWidgets = async (options) => {
options = options || {};
Expand Down Expand Up @@ -1052,16 +1052,16 @@ export const buildWidgets = async (options) => {
/**
* Build CesiumJS.
*
* @param {Object} options
* @param {Boolean} [options.development=true] True if build is targeted for development.
* @param {Boolean} [options.iife=true] True if IIFE bundle should be generated.
* @param {Boolean} [options.incremental=true] True if builds should be generated incrementally.
* @param {Boolean} [options.minify=false] True if bundles should be minified.
* @param {Boolean} [options.node=true] True if CommonJS bundle should be generated.
* @param {Boolean} options.outputDirectory The directory where the output should go.
* @param {Boolean} [options.removePragmas=false] True if debug pragmas should be removed.
* @param {Boolean} [options.sourcemap=true] True if sourcemap should be included in the generated bundles.
* @param {Boolean} [options.write=true] True if bundles generated are written to files instead of in-memory buffers.
* @param {object} options
* @param {boolean} [options.development=true] True if build is targeted for development.
* @param {boolean} [options.iife=true] True if IIFE bundle should be generated.
* @param {boolean} [options.incremental=true] True if builds should be generated incrementally.
* @param {boolean} [options.minify=false] True if bundles should be minified.
* @param {boolean} [options.node=true] True if CommonJS bundle should be generated.
* @param {boolean} options.outputDirectory The directory where the output should go.
* @param {boolean} [options.removePragmas=false] True if debug pragmas should be removed.
* @param {boolean} [options.sourcemap=true] True if sourcemap should be included in the generated bundles.
* @param {boolean} [options.write=true] True if bundles generated are written to files instead of in-memory buffers.
*/
export async function buildCesium(options) {
const development = options.development ?? true;
Expand Down
34 changes: 17 additions & 17 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ export const release = gulp.series(
* Removes scripts from package.json files to ensure that
* they still work when run from within the ZIP file.
*
* @param {String} packageJsonPath The path to the package.json.
* @param {string} packageJsonPath The path to the package.json.
* @returns {WritableStream} A stream that writes to the updated package.json file.
*/
async function pruneScriptsForZip(packageJsonPath) {
Expand Down Expand Up @@ -1250,15 +1250,15 @@ async function setStatus(state, targetUrl, description, context) {
/**
* Generates coverage report.
*
* @param {Object} options An object with the following properties:
* @param {String} options.outputDirectory The output directory for the generated build artifacts.
* @param {String} options.coverageDirectory The path where the coverage reports should be saved to.
* @param {String} options.specList The path to the spec list for the package.
* @param {object} options An object with the following properties:
* @param {string} options.outputDirectory The output directory for the generated build artifacts.
* @param {string} options.coverageDirectory The path where the coverage reports should be saved to.
* @param {string} options.specList The path to the spec list for the package.
* @param {RegExp} options.filter The filter for finding which files should be instrumented.
* @param {Boolean} [options.webglStub=false] True if WebGL stub should be used when running tests.
* @param {Boolean} [options.suppressPassed=false] True if output should be suppressed for tests that pass.
* @param {Boolean} [options.failTaskOnError=false] True if the gulp task should fail on errors in the tests.
* @param {String} options.workspace The name of the workspace, if any.
* @param {boolean} [options.webglStub=false] True if WebGL stub should be used when running tests.
* @param {boolean} [options.suppressPassed=false] True if output should be suppressed for tests that pass.
* @param {boolean} [options.failTaskOnError=false] True if the gulp task should fail on errors in the tests.
* @param {string} options.workspace The name of the workspace, if any.
*/
export async function runCoverage(options) {
const webglStub = options.webglStub ?? false;
Expand Down Expand Up @@ -1635,7 +1635,7 @@ export async function test() {
* Generates TypeScript definition file (.d.ts) for a package.
*
* @param {*} workspaceName
* @param {String} definitionsPath The path of the .d.ts file to generate.
* @param {string} definitionsPath The path of the .d.ts file to generate.
* @param {*} configurationPath
* @param {*} processSourceFunc
* @param {*} processModulesFunc
Expand Down Expand Up @@ -1920,9 +1920,9 @@ ${source}

/**
* Reads `ThirdParty.extra.json` file
* @param path {string} Path to `ThirdParty.extra.json`
* @param discoveredDependencies {Array<string>} List of previously discovered modules
* @returns {Promise<Array<Object>>} A promise to an array of objects with 'name`, `license`, and `url` strings
* @param {string} path Path to `ThirdParty.extra.json`
* @param {string[]} discoveredDependencies List of previously discovered modules
* @returns {Promise<object[]>} A promise to an array of objects with 'name`, `license`, and `url` strings
*/
async function getLicenseDataFromThirdPartyExtra(path, discoveredDependencies) {
if (!existsSync(path)) {
Expand Down Expand Up @@ -1973,10 +1973,10 @@ async function getLicenseDataFromThirdPartyExtra(path, discoveredDependencies) {
/**
* Extracts name, license, and url from `package.json` file.
*
* @param packageName {string} Name of package
* @param discoveredDependencies {Array<string>} List of previously discovered modules
* @param licenseOverride {Array<string>} If specified, override info fetched from package.json. Useful in the case where there are multiple licenses and we might chose a single one.
* @returns {Promise<Object>} A promise to an object with 'name`, `license`, and `url` strings
* @param {string} packageName Name of package
* @param {string[]} discoveredDependencies List of previously discovered modules
* @param {string[]} licenseOverride If specified, override info fetched from package.json. Useful in the case where there are multiple licenses and we might chose a single one.
* @returns {Promise<object>} A promise to an object with 'name`, `license`, and `url` strings
*/
async function getLicenseDataFromPackage(
packageJson,
Expand Down
Loading

0 comments on commit 3d8f538

Please sign in to comment.