├── .yarnrc.yml
├── crates
├── package.json
├── plugin_manifest
│ ├── src
│ │ ├── lib.rs
│ │ └── plugin.rs
│ └── Cargo.toml
├── swc_compiler
│ ├── src
│ │ └── lib.rs
│ └── Cargo.toml
├── node_binding
│ ├── build.rs
│ ├── npm
│ │ ├── darwin-x64
│ │ │ ├── README.md
│ │ │ └── package.json
│ │ ├── darwin-arm64
│ │ │ ├── README.md
│ │ │ └── package.json
│ │ ├── darwin-universal
│ │ │ ├── README.md
│ │ │ └── package.json
│ │ ├── linux-x64-gnu
│ │ │ ├── README.md
│ │ │ └── package.json
│ │ ├── win32-ia32-msvc
│ │ │ ├── README.md
│ │ │ └── package.json
│ │ ├── win32-x64-msvc
│ │ │ ├── README.md
│ │ │ └── package.json
│ │ ├── linux-arm64-gnu
│ │ │ ├── README.md
│ │ │ └── package.json
│ │ ├── linux-x64-musl
│ │ │ ├── README.md
│ │ │ └── package.json
│ │ ├── win32-arm64-msvc
│ │ │ ├── README.md
│ │ │ └── package.json
│ │ └── linux-arm64-musl
│ │ │ ├── README.md
│ │ │ └── package.json
│ ├── package.json
│ ├── src
│ │ ├── compiler.rs
│ │ ├── panic.rs
│ │ ├── diagnostic.rs
│ │ └── resolver_factory.rs
│ └── Cargo.toml
├── swc_keep_export
│ ├── src
│ │ └── lib.rs
│ └── Cargo.toml
├── binding_values
│ ├── src
│ │ ├── raw_options
│ │ │ ├── raw_mode.rs
│ │ │ ├── raw_node.rs
│ │ │ ├── raw_experiments
│ │ │ │ ├── raw_rspack_future.rs
│ │ │ │ ├── raw_cache
│ │ │ │ │ ├── raw_storage.rs
│ │ │ │ │ ├── raw_snapshot.rs
│ │ │ │ │ └── mod.rs
│ │ │ │ ├── mod.rs
│ │ │ │ └── raw_incremental.rs
│ │ │ ├── raw_stats.rs
│ │ │ ├── raw_cache.rs
│ │ │ ├── raw_builtins
│ │ │ │ ├── raw_ids.rs
│ │ │ │ ├── raw_limit_chunk_count.rs
│ │ │ │ ├── raw_bundle_info.rs
│ │ │ │ ├── raw_ignore.rs
│ │ │ │ ├── raw_size_limits.rs
│ │ │ │ ├── raw_css_extract.rs
│ │ │ │ ├── raw_runtime_chunk.rs
│ │ │ │ ├── raw_progress.rs
│ │ │ │ ├── raw_banner.rs
│ │ │ │ ├── raw_swc_js_minimizer.rs
│ │ │ │ ├── raw_lazy_compilation.rs
│ │ │ │ ├── raw_lightning_css_minimizer.rs
│ │ │ │ ├── raw_dll.rs
│ │ │ │ ├── raw_html.rs
│ │ │ │ ├── raw_copy.rs
│ │ │ │ └── raw_mf.rs
│ │ │ ├── raw_split_chunks
│ │ │ │ ├── raw_split_chunk_size.rs
│ │ │ │ ├── raw_split_chunk_chunks.rs
│ │ │ │ ├── raw_split_chunk_cache_group_test.rs
│ │ │ │ └── raw_split_chunk_name.rs
│ │ │ ├── raw_dynamic_entry.rs
│ │ │ ├── raw_optimization.rs
│ │ │ └── raw_external.rs
│ │ ├── options
│ │ │ ├── mod.rs
│ │ │ └── entry.rs
│ │ ├── plugins
│ │ │ ├── mod.rs
│ │ │ ├── buildtime_plugins.rs
│ │ │ ├── js_loader
│ │ │ │ ├── mod.rs
│ │ │ │ ├── scheduler.rs
│ │ │ │ └── context.rs
│ │ │ └── context_replacement.rs
│ │ ├── identifier.rs
│ │ ├── utils.rs
│ │ ├── clean_options.rs
│ │ ├── resource_data.rs
│ │ ├── asset_condition.rs
│ │ ├── lib.rs
│ │ ├── normal_module_factory.rs
│ │ ├── codegen_result.rs
│ │ ├── resolver.rs
│ │ ├── path_data.rs
│ │ ├── rspack_error.rs
│ │ ├── compilation
│ │ │ └── dependencies.rs
│ │ ├── exports_info.rs
│ │ ├── filename.rs
│ │ ├── chunk_graph.rs
│ │ ├── dependency_block.rs
│ │ ├── asset.rs
│ │ ├── module_graph_connection.rs
│ │ └── module_graph.rs
│ └── Cargo.toml
├── swc_change_package_import
│ ├── .gitignore
│ ├── tests
│ │ └── fixture
│ │ │ ├── ice_basic_transform
│ │ │ ├── input.js
│ │ │ └── output.js
│ │ │ ├── single_specific_transform
│ │ │ ├── input.js
│ │ │ └── output.js
│ │ │ ├── ice_alias_transform
│ │ │ ├── input.js
│ │ │ └── output.js
│ │ │ ├── ice_as_transform
│ │ │ ├── input.js
│ │ │ └── output.js
│ │ │ ├── single_specific_transform_2
│ │ │ ├── input.js
│ │ │ └── output.js
│ │ │ ├── ice_alias_with_as_transform
│ │ │ ├── input.js
│ │ │ └── output.js
│ │ │ ├── ice_miss_match_transform
│ │ │ ├── input.js
│ │ │ └── output.js
│ │ │ ├── ice_multiple_transform
│ │ │ ├── input.js
│ │ │ └── output.js
│ │ │ ├── ice_matched_transform
│ │ │ ├── input.js
│ │ │ └── output.js
│ │ │ ├── single_literal_transform
│ │ │ ├── input.js
│ │ │ └── output.js
│ │ │ ├── mix_specific_transform
│ │ │ ├── input.js
│ │ │ └── output.js
│ │ │ ├── multi_specific_transform
│ │ │ ├── input.js
│ │ │ └── output.js
│ │ │ └── multi_literal_transform
│ │ │ ├── input.js
│ │ │ └── output.js
│ ├── src
│ │ ├── lib.rs
│ │ └── config.rs
│ ├── package.json
│ └── Cargo.toml
├── swc_remove_export
│ ├── src
│ │ └── lib.rs
│ └── Cargo.toml
├── swc_env_replacement
│ ├── src
│ │ └── lib.rs
│ └── Cargo.toml
├── swc_named_import_transform
│ ├── Cargo.toml
│ └── src
│ │ └── lib.rs
├── swc_optimize_barrel
│ └── Cargo.toml
├── loader_barrel
│ └── Cargo.toml
└── loader_compilation
│ ├── Cargo.toml
│ └── src
│ └── transform.rs
├── pnpm-workspace.yaml
├── scripts
├── clone-rspack.mjs
├── clean.mjs
├── test.mjs
└── github.mjs
├── .npmignore
├── rust-toolchain.toml
├── rustfmt.toml
├── README.md
├── package.json
├── .github
├── actions
│ ├── clone-crates
│ │ └── action.yml
│ ├── pnpm-cache
│ │ └── action.yml
│ └── rustup
│ │ └── action.yml
└── workflows
│ └── ci.yml
├── .cargo
└── config.toml
└── .gitignore
/.yarnrc.yml:
--------------------------------------------------------------------------------
1 | nodeLinker: node-modules
--------------------------------------------------------------------------------
/crates/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "1.2.2"
3 | }
--------------------------------------------------------------------------------
/pnpm-workspace.yaml:
--------------------------------------------------------------------------------
1 | packages:
2 | - "crates/node_binding"
--------------------------------------------------------------------------------
/crates/plugin_manifest/src/lib.rs:
--------------------------------------------------------------------------------
1 | mod plugin;
2 | pub use plugin::*;
3 |
--------------------------------------------------------------------------------
/crates/swc_compiler/src/lib.rs:
--------------------------------------------------------------------------------
1 | mod compiler;
2 | pub use compiler::*;
3 |
--------------------------------------------------------------------------------
/crates/node_binding/build.rs:
--------------------------------------------------------------------------------
1 | fn main() {
2 | napi_build::setup();
3 | }
4 |
--------------------------------------------------------------------------------
/crates/swc_keep_export/src/lib.rs:
--------------------------------------------------------------------------------
1 | mod transform;
2 | pub use transform::*;
3 |
--------------------------------------------------------------------------------
/crates/binding_values/src/raw_options/raw_mode.rs:
--------------------------------------------------------------------------------
1 | pub type RawMode = String;
2 |
--------------------------------------------------------------------------------
/crates/swc_change_package_import/.gitignore:
--------------------------------------------------------------------------------
1 | /target
2 | ^target/
3 | target
4 |
--------------------------------------------------------------------------------
/crates/swc_remove_export/src/lib.rs:
--------------------------------------------------------------------------------
1 | mod transform;
2 | pub use transform::*;
3 |
--------------------------------------------------------------------------------
/crates/swc_change_package_import/tests/fixture/ice_basic_transform/input.js:
--------------------------------------------------------------------------------
1 | import {runApp} from "ice";
--------------------------------------------------------------------------------
/crates/swc_change_package_import/tests/fixture/single_specific_transform/input.js:
--------------------------------------------------------------------------------
1 | import { x } from "y";
--------------------------------------------------------------------------------
/crates/binding_values/src/options/mod.rs:
--------------------------------------------------------------------------------
1 | pub mod entry;
2 | pub mod library;
3 | pub mod raw_resolve;
4 |
--------------------------------------------------------------------------------
/crates/swc_change_package_import/tests/fixture/ice_alias_transform/input.js:
--------------------------------------------------------------------------------
1 | import { Head } from 'ice';
2 |
--------------------------------------------------------------------------------
/crates/swc_change_package_import/tests/fixture/ice_as_transform/input.js:
--------------------------------------------------------------------------------
1 | import {runApp as run} from 'ice';
--------------------------------------------------------------------------------
/crates/swc_change_package_import/tests/fixture/single_specific_transform_2/input.js:
--------------------------------------------------------------------------------
1 | import {x as k} from "y";
--------------------------------------------------------------------------------
/scripts/clone-rspack.mjs:
--------------------------------------------------------------------------------
1 | import { getRspackCrates } from './github.mjs';
2 |
3 | getRspackCrates();
4 |
--------------------------------------------------------------------------------
/crates/swc_change_package_import/tests/fixture/ice_alias_transform/output.js:
--------------------------------------------------------------------------------
1 | import Head from "react-helmet";
2 |
--------------------------------------------------------------------------------
/crates/swc_change_package_import/tests/fixture/single_specific_transform_2/output.js:
--------------------------------------------------------------------------------
1 | import { a as k } from "m/n";
--------------------------------------------------------------------------------
/crates/swc_env_replacement/src/lib.rs:
--------------------------------------------------------------------------------
1 | #![feature(box_patterns)]
2 | mod transform;
3 | pub use transform::*;
4 |
--------------------------------------------------------------------------------
/crates/swc_change_package_import/tests/fixture/ice_as_transform/output.js:
--------------------------------------------------------------------------------
1 | import { runApp as run } from "@ice/runtime";
--------------------------------------------------------------------------------
/crates/swc_change_package_import/tests/fixture/ice_basic_transform/output.js:
--------------------------------------------------------------------------------
1 | import { runApp } from "@ice/runtime";
--------------------------------------------------------------------------------
/crates/swc_change_package_import/tests/fixture/single_specific_transform/output.js:
--------------------------------------------------------------------------------
1 | import { a as x } from "m/n";
2 |
--------------------------------------------------------------------------------
/crates/swc_change_package_import/tests/fixture/ice_alias_with_as_transform/input.js:
--------------------------------------------------------------------------------
1 | import { Head as Header } from 'ice';
--------------------------------------------------------------------------------
/crates/swc_change_package_import/tests/fixture/ice_alias_with_as_transform/output.js:
--------------------------------------------------------------------------------
1 | import Header from "react-helmet";
2 |
--------------------------------------------------------------------------------
/crates/swc_change_package_import/tests/fixture/ice_miss_match_transform/input.js:
--------------------------------------------------------------------------------
1 | import { defineDataLoader } from 'ice';
--------------------------------------------------------------------------------
/crates/swc_change_package_import/tests/fixture/ice_miss_match_transform/output.js:
--------------------------------------------------------------------------------
1 | import { defineDataLoader } from 'ice';
--------------------------------------------------------------------------------
/crates/swc_change_package_import/tests/fixture/ice_multiple_transform/input.js:
--------------------------------------------------------------------------------
1 | import { request, store, test } from 'ice';
--------------------------------------------------------------------------------
/crates/swc_change_package_import/tests/fixture/ice_matched_transform/input.js:
--------------------------------------------------------------------------------
1 | import { runApp, defineDataLoader } from "ice";
--------------------------------------------------------------------------------
/crates/swc_change_package_import/tests/fixture/single_literal_transform/input.js:
--------------------------------------------------------------------------------
1 | import {x} from "y";
2 | import {p} from "q";
3 | import j from "k";
--------------------------------------------------------------------------------
/crates/node_binding/npm/darwin-x64/README.md:
--------------------------------------------------------------------------------
1 | # `@ice/pack-binding-darwin-x64`
2 |
3 | This is the **x86_64-apple-darwin** binary for `@ice/pack-binding`
4 |
--------------------------------------------------------------------------------
/crates/swc_change_package_import/src/lib.rs:
--------------------------------------------------------------------------------
1 | mod change_package_import;
2 | mod config;
3 |
4 | pub use change_package_import::*;
5 | pub use config::*;
6 |
--------------------------------------------------------------------------------
/crates/swc_change_package_import/tests/fixture/single_literal_transform/output.js:
--------------------------------------------------------------------------------
1 | import x from "y/x";
2 | import { p } from "q";
3 | import j from "k";
4 |
--------------------------------------------------------------------------------
/crates/node_binding/npm/darwin-arm64/README.md:
--------------------------------------------------------------------------------
1 | # `@ice/pack-binding-darwin-arm64`
2 |
3 | This is the **aarch64-apple-darwin** binary for `@ice/pack-binding`
4 |
--------------------------------------------------------------------------------
/crates/node_binding/npm/darwin-universal/README.md:
--------------------------------------------------------------------------------
1 | # `@ice/pack-binding-darwin-universal`
2 |
3 | This is the **universal-apple-darwin** binary for `@ice/pack-binding`
--------------------------------------------------------------------------------
/crates/node_binding/npm/linux-x64-gnu/README.md:
--------------------------------------------------------------------------------
1 | # `@ice/pack-binding-linux-x64-gnu`
2 |
3 | This is the **x86_64-unknown-linux-gnu** binary for `@ice/pack-binding`
4 |
--------------------------------------------------------------------------------
/crates/node_binding/npm/win32-ia32-msvc/README.md:
--------------------------------------------------------------------------------
1 | # `@ice/pack-binding-win32-ia32-msvc`
2 |
3 | This is the **i686-pc-windows-msvc** binary for `@ice/pack-binding`
4 |
--------------------------------------------------------------------------------
/crates/node_binding/npm/win32-x64-msvc/README.md:
--------------------------------------------------------------------------------
1 | # `@ice/pack-binding-win32-x64-msvc`
2 |
3 | This is the **x86_64-pc-windows-msvc** binary for `@ice/pack-binding`
4 |
--------------------------------------------------------------------------------
/scripts/clean.mjs:
--------------------------------------------------------------------------------
1 | import { copyAndCleanUp, getGithubInfo } from "./github.mjs";
2 |
3 | const { temp, dest } = getGithubInfo();
4 | copyAndCleanUp(temp, dest);
5 |
--------------------------------------------------------------------------------
/crates/node_binding/npm/linux-arm64-gnu/README.md:
--------------------------------------------------------------------------------
1 | # `@ice/pack-binding-linux-arm64-gnu`
2 |
3 | This is the **aarch64-unknown-linux-gnu** binary for `@ice/pack-binding`
4 |
--------------------------------------------------------------------------------
/crates/node_binding/npm/linux-x64-musl/README.md:
--------------------------------------------------------------------------------
1 | # `@ice/pack-binding-linux-x64-musl`
2 |
3 | This is the **x86_64-unknown-linux-musl** binary for `@ice/pack-binding`
4 |
--------------------------------------------------------------------------------
/crates/node_binding/npm/win32-arm64-msvc/README.md:
--------------------------------------------------------------------------------
1 | # `@ice/pack-binding-win32-arm64-msvc`
2 |
3 | This is the **aarch64-pc-windows-msvc** binary for `@ice/pack-binding`
4 |
--------------------------------------------------------------------------------
/crates/swc_change_package_import/tests/fixture/ice_matched_transform/output.js:
--------------------------------------------------------------------------------
1 | import { runApp } from "@ice/runtime";
2 | import { defineDataLoader } from "@ice/runtime";
--------------------------------------------------------------------------------
/crates/node_binding/npm/linux-arm64-musl/README.md:
--------------------------------------------------------------------------------
1 | # `@ice/pack-binding-linux-arm64-musl`
2 |
3 | This is the **arm64-unknown-linux-musl** binary for `@ice/pack-binding`
4 |
--------------------------------------------------------------------------------
/crates/swc_change_package_import/tests/fixture/mix_specific_transform/input.js:
--------------------------------------------------------------------------------
1 | import {Button, Spin} from "antd";
2 | import {a} from "ice";
3 | import {isArray} from "lodash";
--------------------------------------------------------------------------------
/crates/swc_change_package_import/tests/fixture/ice_multiple_transform/output.js:
--------------------------------------------------------------------------------
1 | import { request } from "axios";
2 | import store from "@ice/store";
3 | import { test } from "axios";
4 |
--------------------------------------------------------------------------------
/.npmignore:
--------------------------------------------------------------------------------
1 | target
2 | Cargo.lock
3 | .cargo
4 | .github
5 | npm
6 | .eslintrc
7 | .prettierignore
8 | rustfmt.toml
9 | yarn.lock
10 | *.node
11 | .yarn
12 | __test__
13 | renovate.json
14 |
--------------------------------------------------------------------------------
/crates/swc_change_package_import/tests/fixture/multi_specific_transform/input.js:
--------------------------------------------------------------------------------
1 | import {a, b, c as d} from "e";
2 | import {j, q} from "k"
3 | // import "f";
4 | // import g from "k";
5 | // import y from "z";
--------------------------------------------------------------------------------
/crates/swc_change_package_import/tests/fixture/multi_specific_transform/output.js:
--------------------------------------------------------------------------------
1 | import { a, b, c as d } from "e";
2 | import { j, q } from "k"; // import "f";
3 | // import g from "k";
4 | // import y from "z";
--------------------------------------------------------------------------------
/crates/swc_change_package_import/tests/fixture/multi_literal_transform/input.js:
--------------------------------------------------------------------------------
1 | import a from "b";
2 | import {x, y} from "z";
3 | import c from "d";
4 | import {p, q as r} from "o";
5 | // import {a, c, d} from "i";
--------------------------------------------------------------------------------
/crates/swc_change_package_import/tests/fixture/mix_specific_transform/output.js:
--------------------------------------------------------------------------------
1 | import Button from "antd/Button";
2 | import Spin from "antd/Spin";
3 | import a from "@ice/x/y";
4 | import { isArray } from "lodash";
5 |
--------------------------------------------------------------------------------
/rust-toolchain.toml:
--------------------------------------------------------------------------------
1 | [toolchain]
2 | profile = "default"
3 | # Use nightly for better access to the latest Rust features.
4 | # This date is aligned to stable release dates.
5 | channel = "nightly-2024-11-27" # v1.83.0
6 |
--------------------------------------------------------------------------------
/crates/binding_values/src/plugins/mod.rs:
--------------------------------------------------------------------------------
1 | mod context_replacement;
2 | mod js_loader;
3 |
4 | pub use context_replacement::*;
5 | pub(super) use js_loader::{JsLoaderRspackPlugin, JsLoaderRunner};
6 | pub mod buildtime_plugins;
7 |
--------------------------------------------------------------------------------
/rustfmt.toml:
--------------------------------------------------------------------------------
1 | format_code_in_doc_comments = true # https://rust-lang.github.io/rustfmt/?version=v1.5.1&search=#format_code_in_doc_comments
2 | tab_spaces = 2
3 |
4 | group_imports = "StdExternalCrate"
5 | unstable_features = true
6 |
--------------------------------------------------------------------------------
/crates/binding_values/src/raw_options/raw_node.rs:
--------------------------------------------------------------------------------
1 | use napi_derive::napi;
2 |
3 | #[derive(Debug, Default)]
4 | #[napi(object)]
5 | pub struct RawNodeOption {
6 | pub dirname: String,
7 | pub filename: String,
8 | pub global: String,
9 | }
10 |
--------------------------------------------------------------------------------
/crates/swc_change_package_import/tests/fixture/multi_literal_transform/output.js:
--------------------------------------------------------------------------------
1 | import a from "b";
2 | import x from "z/x";
3 | import y from "z/y";
4 | import c from "d";
5 | import p from "o/p";
6 | import r from "o/q";
7 | // import {a, c, d} from "i";
8 |
--------------------------------------------------------------------------------
/crates/swc_env_replacement/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "swc_env_replacement"
3 | version = "0.1.0"
4 | edition = "2021"
5 |
6 | [dependencies]
7 | swc_core = { workspace = true, features = [
8 | "base",
9 | "ecma_ast",
10 | "common"
11 | ] }
--------------------------------------------------------------------------------
/crates/swc_named_import_transform/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "swc_named_import_transform"
3 | version = "0.1.0"
4 | edition = "2021"
5 |
6 | [dependencies]
7 | swc_core = { workspace = true, features = [
8 | "base",
9 | "ecma_ast",
10 | "common"
11 | ]}
--------------------------------------------------------------------------------
/crates/swc_keep_export/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "swc_keep_export"
3 | version = "0.1.0"
4 | edition = "2021"
5 |
6 | [dependencies]
7 | fxhash = "0.2.1"
8 | swc_core = { workspace = true, features = [
9 | "base",
10 | "ecma_ast",
11 | "common"
12 | ] }
13 | rspack_error = { path = "../.rspack_crates/rspack_error" }
--------------------------------------------------------------------------------
/crates/swc_remove_export/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "swc_remove_export"
3 | version = "0.1.0"
4 | edition = "2021"
5 |
6 | [dependencies]
7 | fxhash = "0.2.1"
8 | swc_core = { workspace = true, features = [
9 | "base",
10 | "ecma_ast",
11 | "common"
12 | ] }
13 | rspack_error = { path = "../.rspack_crates/rspack_error" }
--------------------------------------------------------------------------------
/crates/swc_optimize_barrel/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "swc_optimize_barrel"
3 | version = "0.1.0"
4 | edition = "2021"
5 |
6 | [dependencies]
7 | serde_json = { workspace = true }
8 | serde = { workspace = true, features = ["derive"] }
9 | swc_core = { workspace = true, features = [
10 | "base",
11 | "ecma_ast",
12 | "common"
13 | ]}
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
A bundler based on Rspack
2 |
3 | This project is under active development. It is based on Rspack, and it will add more built-in features required by ice framework.
4 |
5 | ## Credits
6 |
7 | Thanks to the [rspack](https://github.com/web-infra-dev/rspack) project which provides the ability to customize plugins and loaders implemented by Rust.
8 |
--------------------------------------------------------------------------------
/crates/binding_values/src/raw_options/raw_experiments/raw_rspack_future.rs:
--------------------------------------------------------------------------------
1 | use napi_derive::napi;
2 | use rspack_core::RspackFuture;
3 |
4 | #[allow(clippy::empty_structs_with_brackets)]
5 | #[derive(Debug, Default)]
6 | #[napi(object)]
7 | pub struct RawRspackFuture {}
8 |
9 | impl From for RspackFuture {
10 | fn from(_value: RawRspackFuture) -> Self {
11 | Self {}
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/crates/binding_values/src/raw_options/raw_stats.rs:
--------------------------------------------------------------------------------
1 | use napi_derive::napi;
2 | use rspack_core::StatsOptions;
3 |
4 | #[derive(Debug, Default)]
5 | #[napi(object)]
6 | pub struct RawStatsOptions {
7 | pub colors: bool,
8 | }
9 |
10 | impl From for StatsOptions {
11 | fn from(value: RawStatsOptions) -> Self {
12 | Self {
13 | colors: value.colors,
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/crates/binding_values/src/plugins/buildtime_plugins.rs:
--------------------------------------------------------------------------------
1 | use rspack_core::{BoxPlugin, PluginExt};
2 | use rspack_plugin_javascript::{api_plugin::APIPlugin, JsPlugin};
3 | use rspack_plugin_runtime::RuntimePlugin;
4 |
5 | pub fn buildtime_plugins() -> Vec {
6 | vec![
7 | JsPlugin::default().boxed(),
8 | RuntimePlugin::default().boxed(),
9 | APIPlugin::default().boxed(),
10 | ]
11 | }
12 |
--------------------------------------------------------------------------------
/crates/node_binding/npm/darwin-universal/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@ice/pack-binding-darwin-universal",
3 | "version": "0.0.1",
4 | "os": [
5 | "darwin"
6 | ],
7 | "main": "pack-binding.darwin-universal.node",
8 | "files": [
9 | "pack-binding.darwin-universal.node"
10 | ],
11 | "license": "MIT",
12 | "engines": {
13 | "node": ">= 10"
14 | },
15 | "repository": {
16 | "url": "https://github.com/ice-lab/icepack"
17 | }
18 | }
--------------------------------------------------------------------------------
/crates/swc_change_package_import/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "plugin_optimize_package_import",
3 | "version": "0.1.0",
4 | "description": "",
5 | "author": "",
6 | "license": "ISC",
7 | "keywords": ["swc-plugin"],
8 | "main": "target/wasm32-wasi/release/plugin_optimize_package_import.wasm",
9 | "scripts": {
10 | "prepublishOnly": "cargo build-wasi --release"
11 | },
12 | "files": [],
13 | "preferUnplugged": true
14 | }
15 |
--------------------------------------------------------------------------------
/crates/node_binding/npm/darwin-x64/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@ice/pack-binding-darwin-x64",
3 | "version": "0.0.1",
4 | "os": [
5 | "darwin"
6 | ],
7 | "cpu": [
8 | "x64"
9 | ],
10 | "main": "pack-binding.darwin-x64.node",
11 | "files": [
12 | "pack-binding.darwin-x64.node"
13 | ],
14 | "license": "MIT",
15 | "engines": {
16 | "node": ">= 10"
17 | },
18 | "repository": {
19 | "url": "https://github.com/ice-lab/icepack"
20 | }
21 | }
--------------------------------------------------------------------------------
/crates/node_binding/npm/darwin-arm64/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@ice/pack-binding-darwin-arm64",
3 | "version": "0.0.1",
4 | "os": [
5 | "darwin"
6 | ],
7 | "cpu": [
8 | "arm64"
9 | ],
10 | "main": "pack-binding.darwin-arm64.node",
11 | "files": [
12 | "pack-binding.darwin-arm64.node"
13 | ],
14 | "license": "MIT",
15 | "engines": {
16 | "node": ">= 10"
17 | },
18 | "repository": {
19 | "url": "https://github.com/ice-lab/icepack"
20 | }
21 | }
--------------------------------------------------------------------------------
/crates/node_binding/npm/win32-x64-msvc/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@ice/pack-binding-win32-x64-msvc",
3 | "version": "0.0.1",
4 | "os": [
5 | "win32"
6 | ],
7 | "cpu": [
8 | "x64"
9 | ],
10 | "main": "pack-binding.win32-x64-msvc.node",
11 | "files": [
12 | "pack-binding.win32-x64-msvc.node"
13 | ],
14 | "license": "MIT",
15 | "engines": {
16 | "node": ">= 10"
17 | },
18 | "repository": {
19 | "url": "https://github.com/ice-lab/icepack"
20 | }
21 | }
--------------------------------------------------------------------------------
/crates/node_binding/npm/win32-ia32-msvc/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@ice/pack-binding-win32-ia32-msvc",
3 | "version": "0.0.1",
4 | "os": [
5 | "win32"
6 | ],
7 | "cpu": [
8 | "i686"
9 | ],
10 | "main": "pack-binding.win32-ia32-msvc.node",
11 | "files": [
12 | "pack-binding.win32-ia32-msvc.node"
13 | ],
14 | "license": "MIT",
15 | "engines": {
16 | "node": ">= 10"
17 | },
18 | "repository": {
19 | "url": "https://github.com/ice-lab/icepack"
20 | }
21 | }
--------------------------------------------------------------------------------
/crates/node_binding/npm/win32-arm64-msvc/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@ice/pack-binding-win32-arm64-msvc",
3 | "version": "0.0.1",
4 | "os": [
5 | "win32"
6 | ],
7 | "cpu": [
8 | "arm64"
9 | ],
10 | "main": "pack-binding.win32-arm64-msvc.node",
11 | "files": [
12 | "pack-binding.win32-arm64-msvc.node"
13 | ],
14 | "license": "MIT",
15 | "engines": {
16 | "node": ">= 10"
17 | },
18 | "repository": {
19 | "url": "https://github.com/ice-lab/icepack"
20 | }
21 | }
--------------------------------------------------------------------------------
/crates/node_binding/npm/linux-x64-gnu/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@ice/pack-binding-linux-x64-gnu",
3 | "version": "0.0.1",
4 | "os": [
5 | "linux"
6 | ],
7 | "cpu": [
8 | "x64"
9 | ],
10 | "main": "pack-binding.linux-x64-gnu.node",
11 | "files": [
12 | "pack-binding.linux-x64-gnu.node"
13 | ],
14 | "license": "MIT",
15 | "engines": {
16 | "node": ">= 10"
17 | },
18 | "libc": [
19 | "glibc"
20 | ],
21 | "repository": {
22 | "url": "https://github.com/ice-lab/icepack"
23 | }
24 | }
--------------------------------------------------------------------------------
/crates/node_binding/npm/linux-x64-musl/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@ice/pack-binding-linux-x64-musl",
3 | "version": "0.0.1",
4 | "os": [
5 | "linux"
6 | ],
7 | "cpu": [
8 | "x64"
9 | ],
10 | "main": "pack-binding.linux-x64-musl.node",
11 | "files": [
12 | "pack-binding.linux-x64-musl.node"
13 | ],
14 | "license": "MIT",
15 | "engines": {
16 | "node": ">= 10"
17 | },
18 | "libc": [
19 | "musl"
20 | ],
21 | "repository": {
22 | "url": "https://github.com/ice-lab/icepack"
23 | }
24 | }
--------------------------------------------------------------------------------
/crates/node_binding/npm/linux-arm64-gnu/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@ice/pack-binding-linux-arm64-gnu",
3 | "version": "0.0.1",
4 | "os": [
5 | "linux"
6 | ],
7 | "cpu": [
8 | "arm64"
9 | ],
10 | "main": "pack-binding.linux-arm64-gnu.node",
11 | "files": [
12 | "pack-binding.linux-arm64-gnu.node"
13 | ],
14 | "license": "MIT",
15 | "engines": {
16 | "node": ">= 10"
17 | },
18 | "libc": [
19 | "glibc"
20 | ],
21 | "repository": {
22 | "url": "https://github.com/ice-lab/icepack"
23 | }
24 | }
--------------------------------------------------------------------------------
/crates/node_binding/npm/linux-arm64-musl/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@ice/pack-binding-linux-arm64-musl",
3 | "version": "0.0.1",
4 | "os": [
5 | "linux"
6 | ],
7 | "cpu": [
8 | "arm64"
9 | ],
10 | "main": "pack-binding.linux-arm64-musl.node",
11 | "files": [
12 | "pack-binding.linux-arm64-musl.node"
13 | ],
14 | "license": "MIT",
15 | "engines": {
16 | "node": ">= 10"
17 | },
18 | "libc": [
19 | "musl"
20 | ],
21 | "repository": {
22 | "url": "https://github.com/ice-lab/icepack"
23 | }
24 | }
--------------------------------------------------------------------------------
/crates/binding_values/src/raw_options/raw_cache.rs:
--------------------------------------------------------------------------------
1 | use napi_derive::napi;
2 | use rspack_core::CacheOptions;
3 |
4 | #[derive(Debug, Default)]
5 | #[napi(object, object_to_js = false)]
6 | pub struct RawCacheOptions {
7 | pub r#type: String,
8 | }
9 |
10 | impl From for CacheOptions {
11 | fn from(value: RawCacheOptions) -> CacheOptions {
12 | let RawCacheOptions { r#type } = value;
13 |
14 | match r#type.as_str() {
15 | "memory" => CacheOptions::Memory,
16 | _ => CacheOptions::Disabled,
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/crates/plugin_manifest/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "plugin_manifest"
3 | version = "0.1.0"
4 | edition = "2021"
5 |
6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
7 |
8 | [dependencies]
9 | async-trait = { workspace = true }
10 | tracing = { workspace = true }
11 | regex = { workspace = true }
12 | serde = { workspace = true, features = ["derive"] }
13 | serde_json = { workspace = true }
14 | rspack_core = { workspace = true }
15 | rspack_hook = { workspace = true }
16 | rspack_error = { workspace = true }
--------------------------------------------------------------------------------
/crates/binding_values/src/raw_options/raw_builtins/raw_ids.rs:
--------------------------------------------------------------------------------
1 | use napi_derive::napi;
2 | use rspack_ids::OccurrenceChunkIdsPluginOptions;
3 |
4 | #[derive(Debug)]
5 | #[napi(object, object_to_js = false)]
6 | pub struct RawOccurrenceChunkIdsPluginOptions {
7 | pub prioritise_initial: Option,
8 | }
9 |
10 | impl From for OccurrenceChunkIdsPluginOptions {
11 | fn from(value: RawOccurrenceChunkIdsPluginOptions) -> Self {
12 | Self {
13 | prioritise_initial: value.prioritise_initial.unwrap_or_default(),
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/crates/swc_change_package_import/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "swc_change_package_import"
3 | version = "0.1.0"
4 | edition = "2021"
5 |
6 | [lib]
7 | crate-type = ["cdylib", "rlib"]
8 |
9 | [dependencies]
10 | serde = { workspace = true }
11 | serde_json = { workspace = true }
12 | swc_core = { workspace = true, features = [
13 | "base",
14 | "ecma_ast",
15 | "ecma_utils",
16 | "ecma_visit",
17 | "common",
18 | ] }
19 |
20 | [dev-dependencies]
21 | swc_core = { workspace = true, features = [
22 | "testing_transform",
23 | ] }
24 | testing = { workspace = true }
25 |
--------------------------------------------------------------------------------
/crates/binding_values/src/identifier.rs:
--------------------------------------------------------------------------------
1 | use rspack_collections::Identifier;
2 | use rspack_napi::napi::bindgen_prelude::{Result, ToNapiValue};
3 |
4 | pub struct JsIdentifier(Identifier);
5 |
6 | impl JsIdentifier {
7 | pub fn raw(&self) -> Identifier {
8 | self.0
9 | }
10 | }
11 |
12 | impl From for JsIdentifier {
13 | fn from(value: Identifier) -> Self {
14 | JsIdentifier(value)
15 | }
16 | }
17 |
18 | impl ToNapiValue for JsIdentifier {
19 | unsafe fn to_napi_value(env: napi::sys::napi_env, val: Self) -> Result {
20 | ToNapiValue::to_napi_value(env, val.0.as_str())
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/scripts/test.mjs:
--------------------------------------------------------------------------------
1 | import { spawnSync } from 'child_process';
2 | import fse from 'fs-extra';
3 |
4 | const cratesDir = 'crates';
5 | const crates = fse.readdirSync(cratesDir);
6 |
7 | const packageScripts = [];
8 | crates.forEach((crate) => {
9 | // Check the file if it is a directory.
10 | if (fse.statSync(cratesDir + '/' + crate).isDirectory()) {
11 | // Ingore crates which is temporary and use for binding.
12 | if (!crate.startsWith('.')) {
13 | packageScripts.push('--package', crate);
14 | }
15 | }
16 | });
17 |
18 | spawnSync('cargo', ['test', ...packageScripts], {
19 | cwd: process.cwd(),
20 | stdio: 'inherit',
21 | });
--------------------------------------------------------------------------------
/crates/binding_values/src/utils.rs:
--------------------------------------------------------------------------------
1 | use futures::Future;
2 | use rspack_napi::napi::threadsafe_function::{ThreadsafeFunction, ThreadsafeFunctionCallMode};
3 | use rspack_napi::napi::{bindgen_prelude::*, Env, NapiRaw, Result};
4 |
5 | pub fn callbackify(env: Env, f: Function, fut: F) -> Result<()>
6 | where
7 | R: 'static + ToNapiValue,
8 | F: 'static + Send + Future