Commit graph

3 commits

Author SHA1 Message Date
37c4da58f7 **refactor: consolidate folder structure and improve compatibility**
### Changes:
- **rollup.config.js**:
  - Merged and reformatted `nodeBuiltins` definition for cleaner code.
  - Updated `input` path from `examples/browser_compatible_exports.ts` to `demo/browser_compatible_exports.ts`.
  - Reformatted `replace` plugin configuration for better readability.

- **.github/workflows/deploy-demo.yml**:
  - Updated deployment folder from `examples` to `demo`.

- **Renamed**:
  - `examples/browser_compatible_exports.ts` → `demo/browser_compatible_exports.ts`.

- **scripts/generate-version.js**:
  - Removed unnecessary semicolons for consistent formatting.

### Purpose:
Aligned folder structure by migrating from `examples` to `demo` for uniformity and better organization. Improved code readability and formatting across configurations and scripts.
2025-06-23 10:58:48 -07:00
968bc33a7a **chore: remove unused external dependencies from Rollup config**
### Changes:
- Removed the following unused external dependencies from `rollup.config.js`:
  - `crypto`
  - `os`
  - `stream`
  - `http`
  - `http2`
  - `https`
  - `zlib`

### Purpose:
Simplified the Rollup configuration by eliminating unused external dependencies, reducing complexity, and improving build clarity.
2025-06-20 12:03:48 -07:00
bbcecea9d7 **chore: introduce unified Rollup configuration for browser and Node.js builds**
### Changes:
- Added `rollup.config.js` with custom build logic for unified and browser builds:
  - Included TypeScript support with separate configurations (`tsconfig.unified.json` and `tsconfig.browser.json`).
  - Consolidated environment detection logic with `globalThis.__ENV__` for browser, Node.js, and serverless environments.
  - Provided global Buffer polyfill for browser environments.
  - Enabled `inlineDynamicImports` for module compatibility.
- Introduced custom Rollup plugins:
  - Shims for Node.js built-in modules to ensure compatibility in browsers.
  - Fixes for `this` references in TensorFlow.js layers causing errors in browser environments.
- Enabled environment-specific replacements for `process.env.NODE_ENV` during builds.
- Configured outputs for both non-minified and minified builds (`.js` and `.min.js` files).
- Excluded specific dependencies from the bundle to optimize build size.

### Purpose:
Added a versatile Rollup configuration to streamline the build process for both browser and Node.js environments. This setup enhances cross-environment compatibility, reduces redundancy, and ensures better maintainability with unified build logic.
2025-06-19 16:05:59 -07:00