Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/core-math/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
index.js
index.d.ts
index.tsc.d.ts
Build
Specs/SpecList.js
docs
3 changes: 3 additions & 0 deletions packages/core-math/Source/Cartesian2.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { Check, defined, DeveloperError } from "@cesium/core-utils";
import CesiumMath from "./Math.js";

/** @ignore @typedef {import('./Cartesian3.js')} Cartesian3 */
/** @ignore @typedef {import('./Cartesian4.js')} Cartesian4 */

/**
* A 2D Cartesian point.
* @alias Cartesian2
Expand Down
2 changes: 2 additions & 0 deletions packages/core-math/Source/Cartesian4.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { Check, defined, DeveloperError } from "@cesium/core-utils";
import CesiumMath from "./Math.js";

/** @ignore @typedef {import('@cesium/engine').Color} Color */

/**
* A 4D Cartesian point.
* @alias Cartesian4
Expand Down
4 changes: 4 additions & 0 deletions packages/core-math/Source/Matrix4.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ import {
import CesiumMath from "./Math.js";
import Matrix3 from "./Matrix3.js";

/** @ignore @typedef {import('@cesium/engine').Camera} Camera */
/** @ignore @typedef {import('@cesium/engine').TranslationRotationScale} TranslationRotationScale */
/** @ignore @typedef {import('@cesium/engine').Quaternion} Quaternion */

/**
* A 4x4 matrix, indexable as a column-major order array.
* Constructor parameters are in row-major order for code readability.
Expand Down
1 change: 1 addition & 0 deletions packages/core-math/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"scripts": {
"build": "gulp build --workspace @cesium/core-math",
"build-ts": "gulp buildTs --workspace @cesium/core-math",
"build-tsc": "tsc --checkJs false",
"coverage": "gulp coverage --workspace @cesium/core-math",
"test": "gulp test --workspace @cesium/core-math",
"postversion": "gulp postversion --workspace @cesium/core-math",
Expand Down
12 changes: 9 additions & 3 deletions packages/core-math/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
{
"include": ["index.js", "Source/**/*.js"],
"include": ["Source/**/*.js"],
"compilerOptions": {
// module configuration
"moduleResolution": "bundler",
"module": "ES2022",
"target": "ES2022",

// i/o
"noEmit": true,
"declaration": true,
"declarationDir": "Build/Types",
"emitDeclarationOnly": true,
"allowJs": true,
"checkJs": true
"checkJs": true,

// ignore type definitions in other modules for now, we need types
// to be correct and to resolve imports first.
"skipLibCheck": true
}
}
1 change: 1 addition & 0 deletions packages/core-utils/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
index.js
index.d.ts
index.tsc.d.ts
Build
Specs/SpecList.js
docs
1 change: 1 addition & 0 deletions packages/core-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"scripts": {
"build": "gulp build --workspace @cesium/core-utils",
"build-ts": "gulp buildTs --workspace @cesium/core-utils",
"build-tsc": "tsc --checkJs false",
"build-docs": "typedoc ./index.js --skipErrorChecking",
"coverage": "gulp coverage --workspace @cesium/core-utils",
"test": "gulp test --workspace @cesium/core-utils",
Expand Down
12 changes: 9 additions & 3 deletions packages/core-utils/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
{
"include": ["index.js", "Source/**/*.js"],
"include": ["Source/**/*.js"],
"compilerOptions": {
// module configuration
"moduleResolution": "bundler",
"module": "ES2022",
"target": "ES2022",

// i/o
"noEmit": true,
"declaration": true,
"declarationDir": "Build/Types",
"emitDeclarationOnly": true,
"allowJs": true,
"checkJs": true
"checkJs": true,

// ignore type definitions in other modules for now, we need types
// to be correct and to resolve imports first.
"skipLibCheck": true
}
}
9 changes: 9 additions & 0 deletions scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -916,6 +916,7 @@ export async function bundleTestWorkers(options) {
export async function createIndexJs(workspace) {
const version = await getVersion();
let contents = `globalThis.CESIUM_VERSION = "${version}";\n`;
let contentsDts = "";

// Re-export core-utils and core-math types for backwards compatibility in engine package
if (workspace === "engine") {
Expand All @@ -937,6 +938,7 @@ export async function createIndexJs(workspace) {

let moduleId = file;
moduleId = filePathToModuleId(moduleId);
const moduleTypesId = moduleId.replace("Source", "Build/Types");

// Rename shader files, such that ViewportQuadFS.glsl is exported as _shadersViewportQuadFS in JS.

Expand All @@ -946,6 +948,7 @@ export async function createIndexJs(workspace) {
}
assignmentName = assignmentName.replace(/(\.|-)/g, "_");
contents += `export { default as ${assignmentName} } from './${moduleId}.js';${EOL}`;
contentsDts += `export { default as ${assignmentName} } from './${moduleTypesId}.js';${EOL}`;

// TODO(donmccurdy): Why is this needed?
if (assignmentName === "Math") {
Expand All @@ -957,6 +960,12 @@ export async function createIndexJs(workspace) {
encoding: "utf-8",
});

if (workspace === "core-math" || workspace === "core-utils") {
await writeFile(`packages/${workspace}/index.tsc.d.ts`, contentsDts, {
encoding: "utf-8",
});
}

return contents;
}

Expand Down
Loading