From 6e6d43910150fa573521e82441386d508b633872 Mon Sep 17 00:00:00 2001 From: Boshen Date: Tue, 5 Dec 2023 12:25:30 +0800 Subject: [PATCH] feat: add rspack-manifest-plugin@5 --- .../rspack-manifest-plugin@5/package.json | 13 +++++++ .../rspack-manifest-plugin@5/rspack.config.js | 27 +++++++++++++ .../rspack-manifest-plugin@5/src/index.js | 3 ++ pnpm-lock.yaml | 38 +++++++++++++++++-- 4 files changed, 78 insertions(+), 3 deletions(-) create mode 100644 packages/rspack-manifest-plugin@5/package.json create mode 100644 packages/rspack-manifest-plugin@5/rspack.config.js create mode 100644 packages/rspack-manifest-plugin@5/src/index.js diff --git a/packages/rspack-manifest-plugin@5/package.json b/packages/rspack-manifest-plugin@5/package.json new file mode 100644 index 0000000..bb7a59d --- /dev/null +++ b/packages/rspack-manifest-plugin@5/package.json @@ -0,0 +1,13 @@ +{ + "name": "@rspack-compat/rspack-manifest-plugin_4", + "scripts": { + "build": "rspack build" + }, + "devDependencies": { + "@rspack/cli": "0.3.11", + "rspack-manifest-plugin": "5.0.0-alpha0" + }, + "rspack": { + "version": ">=0.3.11" + } +} diff --git a/packages/rspack-manifest-plugin@5/rspack.config.js b/packages/rspack-manifest-plugin@5/rspack.config.js new file mode 100644 index 0000000..9196c3a --- /dev/null +++ b/packages/rspack-manifest-plugin@5/rspack.config.js @@ -0,0 +1,27 @@ +const { defineConfig } = require('@rspack/cli') +const { WebpackManifestPlugin: RspackManifestPlugin } = require("rspack-manifest-plugin"); + +module.exports = defineConfig({ + plugins: [ + new RspackManifestPlugin({ + fileName: "rspack-manifest.json", + generate: (seed, files, entries) => { + const manifestFiles = files.reduce((manifest, file) => { + manifest[file.name] = file.path; + return manifest; + }, seed); + const entrypointFiles = Object.keys(entries).reduce( + (previous, name) => + previous.concat( + entries[name].filter(fileName => !fileName.endsWith(".map")) + ), + [] + ); + return { + files: manifestFiles, + entrypoints: entrypointFiles + }; + } + }) + ] +}); diff --git a/packages/rspack-manifest-plugin@5/src/index.js b/packages/rspack-manifest-plugin@5/src/index.js new file mode 100644 index 0000000..bb74030 --- /dev/null +++ b/packages/rspack-manifest-plugin@5/src/index.js @@ -0,0 +1,3 @@ +function main() { + return 'hello world' +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a34fe01..6500871 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -63,7 +63,16 @@ importers: version: 0.3.11(react-refresh@0.14.0) license-webpack-plugin: specifier: ^4.0.2 - version: 4.0.2(webpack@5.76.0) + version: 4.0.2(webpack@5.89.0) + + packages/rspack-manifest-plugin@5: + devDependencies: + '@rspack/cli': + specifier: 0.3.11 + version: 0.3.11(react-refresh@0.14.0) + rspack-manifest-plugin: + specifier: 5.0.0-alpha0 + version: 5.0.0-alpha0(webpack@5.89.0) packages/webpack-bundle-analyzer@4: devDependencies: @@ -2593,7 +2602,7 @@ packages: shell-quote: 1.8.1 dev: true - /license-webpack-plugin@4.0.2(webpack@5.76.0): + /license-webpack-plugin@4.0.2(webpack@5.89.0): resolution: {integrity: sha512-771TFWFD70G1wLTC4oU2Cw4qvtmNrIw+wRvBtn+okgHl7slJVi7zfNcdmqDL72BojM30VNJ2UHylr1o77U37Jw==} peerDependencies: webpack: '*' @@ -2603,7 +2612,7 @@ packages: webpack-sources: optional: true dependencies: - webpack: 5.76.0 + webpack: 5.89.0 webpack-sources: 3.2.3 dev: true @@ -3302,6 +3311,17 @@ packages: glob: 7.2.3 dev: true + /rspack-manifest-plugin@5.0.0-alpha0(webpack@5.89.0): + resolution: {integrity: sha512-a84H6P/lK0x3kb0I8Qdiwxrnjt1oNW0j+7kwPMWcODJu8eYFBrTXa1t+14n18Jvg9RKIR6llCH16mYxf2d0s8A==} + engines: {node: '>=14'} + peerDependencies: + webpack: ^5.75.0 + dependencies: + tapable: 2.2.1 + webpack: 5.89.0 + webpack-sources: 2.3.1 + dev: true + /run-queue@1.0.3: resolution: {integrity: sha512-ntymy489o0/QQplUDnpYAYUsO50K9SBrIVaKCWDOJzYJts0f9WH9RFJkyagebkw5+y1oi00R7ynNW/d12GBumg==} dependencies: @@ -3515,6 +3535,10 @@ packages: websocket-driver: 0.7.4 dev: true + /source-list-map@2.0.1: + resolution: {integrity: sha512-qnQ7gVMxGNxsiL4lEuJwe/To8UnK7fAnmbGEEH8RpLouuKbeEm0lhbQVFIrNSuB+G7tVrAlVsZgETT5nljf+Iw==} + dev: true + /source-map-support@0.5.21: resolution: {integrity: sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==} dependencies: @@ -4015,6 +4039,14 @@ packages: uuid: 3.4.0 dev: true + /webpack-sources@2.3.1: + resolution: {integrity: sha512-y9EI9AO42JjEcrTJFOYmVywVZdKVUfOvDUPsJea5GIr1JOEGFVqwlY2K098fFoIjOkDzHn2AjRvM8dsBZu+gCA==} + engines: {node: '>=10.13.0'} + dependencies: + source-list-map: 2.0.1 + source-map: 0.6.1 + dev: true + /webpack-sources@3.2.3: resolution: {integrity: sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w==} engines: {node: '>=10.13.0'}