Skip to content

[js/common] allow import onnxruntime-common as ESM and CJS #15772

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 5 commits into from
Jun 12, 2023

Conversation

fs-eire
Copy link
Contributor

@fs-eire fs-eire commented May 2, 2023

Description

allow import onnxruntime-common as ESM and CJS.

@fs-eire fs-eire mentioned this pull request May 2, 2023
@fs-eire fs-eire force-pushed the fs-eire/js-common-module branch from b9ec25d to 1d23564 Compare May 2, 2023 07:14
@fs-eire
Copy link
Contributor Author

fs-eire commented May 3, 2023

Hold this commit. Please merge it after ORT 1.15.0 release.

@fs-eire
Copy link
Contributor Author

fs-eire commented May 8, 2023

This should be merged after #15843

guschmue
guschmue previously approved these changes Jun 9, 2023
fs-eire added a commit that referenced this pull request Jun 9, 2023
### Description
<!-- Describe your changes. -->

refactor tensor type in onnxruntime-common.

### Motivation and Context
There major motivation is that I am doing a local change to address the
API part of #15312. And I am doing a refactoring of onnxruntime-common
anyway (#15772).

The `tensor.ts` and `tensor-impl.ts` are too large, so I split contents
into multiple files to make the type declarations clearer.

The original target of this change is for API only ( ie. do not refactor
any implementation.). However, there are a few type/implementation
inconsistencies so I also made minimal changes to fix them.

### Changes
- extract `TensorUtils` for non-template interfaces
- extract `TensorFactory` for all overloads of `Tensor.fromImage()`
- refactor options type that used for `Tensor.fromImage()`
- fix JSDoc comments to make option descriptions consistent with actual
type declarations
- fix an inconsistency for `options.format` and `options.bitmapFormat`;
change all `bitmapFormat` to `format`
- extract `ConversionUtils` for `tensor.toDataURL()` and
`tensor.toImageData()`
- put implementations into multiple files from `tensor-impl.ts`
- fix a bug that cause unittest fail. put comments for future fix.
@fs-eire fs-eire merged commit e3e4926 into main Jun 12, 2023
@fs-eire fs-eire deleted the fs-eire/js-common-module branch June 12, 2023 19:05
siweic0 pushed a commit to siweic0/onnxruntime-web that referenced this pull request May 9, 2024
### Description
<!-- Describe your changes. -->

refactor tensor type in onnxruntime-common.

### Motivation and Context
There major motivation is that I am doing a local change to address the
API part of microsoft#15312. And I am doing a refactoring of onnxruntime-common
anyway (microsoft#15772).

The `tensor.ts` and `tensor-impl.ts` are too large, so I split contents
into multiple files to make the type declarations clearer.

The original target of this change is for API only ( ie. do not refactor
any implementation.). However, there are a few type/implementation
inconsistencies so I also made minimal changes to fix them.

### Changes
- extract `TensorUtils` for non-template interfaces
- extract `TensorFactory` for all overloads of `Tensor.fromImage()`
- refactor options type that used for `Tensor.fromImage()`
- fix JSDoc comments to make option descriptions consistent with actual
type declarations
- fix an inconsistency for `options.format` and `options.bitmapFormat`;
change all `bitmapFormat` to `format`
- extract `ConversionUtils` for `tensor.toDataURL()` and
`tensor.toImageData()`
- put implementations into multiple files from `tensor-impl.ts`
- fix a bug that cause unittest fail. put comments for future fix.
siweic0 pushed a commit to siweic0/onnxruntime-web that referenced this pull request May 9, 2024
…#15772)

### Description
allow import onnxruntime-common as ESM and CJS.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants