Skip to content

Commit

Permalink
fix: dll manifest zod validation (#9112)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahabhgk authored Jan 24, 2025
1 parent bd65828 commit e21f65e
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = [];
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = typeof module.id;
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import t from "dll/lib";

it("module id should be number type", () => {
expect(t).toBe("number");
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
const rspack = require("@rspack/core");
const path = require("path");

const dllManifest = path.resolve(__dirname, "../../../js/config/dll/numeric-module-id/manifest.json");

/** @type {import("@rspack/core").Configuration[]} */
module.exports = [
{
name: "create-dll",
entry: "./lib.js",
output: {
filename: "lib-dll.js",
library: {
type: "commonjs2",
},
},
optimization: {
moduleIds: 'deterministic',
chunkIds: 'deterministic',
},
plugins: [
new rspack.DllPlugin({
path: dllManifest,
entryOnly: false,
}),
]
},
{
name: "use-dll",
dependencies: ["create-dll"],
entry: "./main.js",
plugins: [
function (compiler) {
compiler.hooks.beforeRun.tap('test', () => {
new rspack.DllReferencePlugin({
manifest: require(dllManifest),
sourceType: "commonjs2",
scope: "dll",
name: "./lib-dll.js",
}).apply(compiler)
})
}
]
}
]
2 changes: 1 addition & 1 deletion packages/rspack/etc/core.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1540,7 +1540,7 @@ export interface DllReferencePluginOptionsContent {
[k: string]: {
buildMeta?: JsBuildMeta;
exports?: string[] | true;
id?: string;
id?: string | number;
};
}

Expand Down
4 changes: 2 additions & 2 deletions packages/rspack/src/lib/DllReferencePlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,14 +133,14 @@ export interface DllReferencePluginOptionsContent {
/**
* Module ID.
*/
id?: string;
id?: string | number;
};
}

const dllReferencePluginOptionsContentItem = z.object({
buildMeta: z.custom<JsBuildMeta>().optional(),
exports: z.array(z.string()).or(z.literal(true)).optional(),
id: z.string().optional()
id: z.string().or(z.number()).optional()
});

const dllReferencePluginOptionsContent = z.record(
Expand Down

2 comments on commit e21f65e

@github-actions
Copy link
Contributor

@github-actions github-actions bot commented on e21f65e Jan 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 Benchmark detail: Open

Name Base (2025-01-24 494aaa1) Current Change
10000_big_production-mode_disable-minimize + exec 37.9 s ± 1.01 s 38.8 s ± 899 ms +2.24 %
10000_development-mode + exec 1.85 s ± 22 ms 1.81 s ± 13 ms -1.90 %
10000_development-mode_hmr + exec 682 ms ± 6 ms 683 ms ± 9.1 ms +0.28 %
10000_production-mode + exec 2.41 s ± 50 ms 2.41 s ± 67 ms -0.07 %
10000_production-mode_persistent-cold + exec 2.55 s ± 46 ms 2.56 s ± 155 ms +0.24 %
10000_production-mode_persistent-hot + exec 1.79 s ± 147 ms 1.76 s ± 65 ms -1.92 %
arco-pro_development-mode + exec 1.78 s ± 73 ms 1.76 s ± 168 ms -0.72 %
arco-pro_development-mode_hmr + exec 388 ms ± 0.94 ms 388 ms ± 3.9 ms +0.08 %
arco-pro_production-mode + exec 3.77 s ± 100 ms 3.78 s ± 185 ms +0.31 %
arco-pro_production-mode_generate-package-json-webpack-plugin + exec 3.88 s ± 132 ms 3.83 s ± 218 ms -1.34 %
arco-pro_production-mode_persistent-cold + exec 3.93 s ± 182 ms 3.95 s ± 125 ms +0.55 %
arco-pro_production-mode_persistent-hot + exec 2.52 s ± 192 ms 2.53 s ± 175 ms +0.56 %
arco-pro_production-mode_traverse-chunk-modules + exec 3.79 s ± 184 ms 3.82 s ± 199 ms +0.65 %
large-dyn-imports_development-mode + exec 2.1 s ± 120 ms 2.09 s ± 81 ms -0.52 %
large-dyn-imports_production-mode + exec 2.14 s ± 51 ms 2.14 s ± 32 ms -0.12 %
threejs_development-mode_10x + exec 1.53 s ± 21 ms 1.53 s ± 32 ms -0.01 %
threejs_development-mode_10x_hmr + exec 777 ms ± 13 ms 788 ms ± 12 ms +1.47 %
threejs_production-mode_10x + exec 5.51 s ± 237 ms 5.47 s ± 379 ms -0.83 %
threejs_production-mode_10x_persistent-cold + exec 5.57 s ± 287 ms 5.59 s ± 305 ms +0.36 %
threejs_production-mode_10x_persistent-hot + exec 4.76 s ± 206 ms 4.76 s ± 354 ms -0.09 %
10000_big_production-mode_disable-minimize + rss memory 8775 MiB ± 358 MiB 8695 MiB ± 51.5 MiB -0.90 %
10000_development-mode + rss memory 643 MiB ± 21 MiB 682 MiB ± 41.8 MiB +5.99 %
10000_development-mode_hmr + rss memory 1283 MiB ± 196 MiB 1330 MiB ± 132 MiB +3.64 %
10000_production-mode + rss memory 636 MiB ± 20.7 MiB 693 MiB ± 17.8 MiB +8.98 %
10000_production-mode_persistent-cold + rss memory 746 MiB ± 12 MiB 773 MiB ± 38.6 MiB +3.62 %
10000_production-mode_persistent-hot + rss memory 723 MiB ± 22 MiB 758 MiB ± 13.8 MiB +4.80 %
arco-pro_development-mode + rss memory 564 MiB ± 22.8 MiB 598 MiB ± 43.4 MiB +6.11 %
arco-pro_development-mode_hmr + rss memory 660 MiB ± 64.2 MiB 700 MiB ± 78.7 MiB +6.00 %
arco-pro_production-mode + rss memory 737 MiB ± 23.7 MiB 756 MiB ± 24.7 MiB +2.67 %
arco-pro_production-mode_generate-package-json-webpack-plugin + rss memory 737 MiB ± 28.8 MiB 766 MiB ± 21.4 MiB +3.92 %
arco-pro_production-mode_persistent-cold + rss memory 865 MiB ± 47.4 MiB 887 MiB ± 62 MiB +2.59 %
arco-pro_production-mode_persistent-hot + rss memory 752 MiB ± 20.5 MiB 795 MiB ± 23.4 MiB +5.68 %
arco-pro_production-mode_traverse-chunk-modules + rss memory 743 MiB ± 32.7 MiB 768 MiB ± 21.9 MiB +3.30 %
large-dyn-imports_development-mode + rss memory 653 MiB ± 4.28 MiB 675 MiB ± 17.1 MiB +3.46 %
large-dyn-imports_production-mode + rss memory 537 MiB ± 6.2 MiB 559 MiB ± 20.8 MiB +4.06 %
threejs_development-mode_10x + rss memory 552 MiB ± 5.19 MiB 573 MiB ± 20.4 MiB +3.68 %
threejs_development-mode_10x_hmr + rss memory 1139 MiB ± 62.6 MiB 1161 MiB ± 157 MiB +1.93 %
threejs_production-mode_10x + rss memory 829 MiB ± 44.9 MiB 866 MiB ± 19.9 MiB +4.53 %
threejs_production-mode_10x_persistent-cold + rss memory 955 MiB ± 63.2 MiB 954 MiB ± 56.5 MiB -0.15 %
threejs_production-mode_10x_persistent-hot + rss memory 879 MiB ± 22.8 MiB 880 MiB ± 25.2 MiB +0.13 %

@github-actions
Copy link
Contributor

@github-actions github-actions bot commented on e21f65e Jan 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 Ecosystem CI detail: Open

suite result
modernjs ❌ failure
rspress ✅ success
rslib ✅ success
rsbuild ✅ success
rsdoctor ✅ success
examples ✅ success
devserver ✅ success
nuxt ✅ success

Please sign in to comment.