From 9e431004019e9f8cd3dafd8405ef1517a7d460cf Mon Sep 17 00:00:00 2001 From: Hana Date: Tue, 16 Apr 2024 14:29:43 +0800 Subject: [PATCH 01/15] chore: introduce api-extractor (#6208) --- .github/workflows/reusable-build.yml | 9 + .gitignore | 6 + .prettierignore | 1 + .vscode/settings.json | 5 +- api-extractor.json | 436 ++ package.json | 5 +- packages/rspack-dev-server/api-extractor.json | 7 + .../rspack-dev-server/etc/dev-server.api.md | 39 + packages/rspack-dev-server/package.json | 4 +- .../api-extractor.json | 7 + .../etc/plugin-react-refresh.api.md | 17 + .../rspack-plugin-react-refresh/package.json | 4 +- packages/rspack-test-tools/api-extractor.json | 7 + .../rspack-test-tools/etc/test-tools.api.md | 1132 ++++ packages/rspack-test-tools/package.json | 4 +- packages/rspack/api-extractor.json | 7 + packages/rspack/etc/core.api.md | 5001 +++++++++++++++++ packages/rspack/package.json | 4 +- packages/rspack/src/Compilation.ts | 9 +- packages/rspack/src/Compiler.ts | 10 +- packages/rspack/src/MultiCompiler.ts | 26 +- packages/rspack/src/MultiWatching.ts | 14 +- packages/rspack/src/RuntimeGlobals.ts | 20 +- .../builtin-plugin/SourceMapDevToolPlugin.ts | 2 +- .../builtin-plugin/SwcJsMinimizerPlugin.ts | 2 +- packages/rspack/src/config/adapterRuleUse.ts | 2 +- packages/rspack/src/config/defaults.ts | 2 +- packages/rspack/src/config/normalization.ts | 7 +- packages/rspack/src/exports.ts | 54 +- .../rspack/src/lib/ModuleFilenameHelpers.js | 56 - .../src/{ => lib}/ModuleFilenameHelpers.ts | 0 pnpm-lock.yaml | 187 + 32 files changed, 6956 insertions(+), 130 deletions(-) create mode 100644 api-extractor.json create mode 100644 packages/rspack-dev-server/api-extractor.json create mode 100644 packages/rspack-dev-server/etc/dev-server.api.md create mode 100644 packages/rspack-plugin-react-refresh/api-extractor.json create mode 100644 packages/rspack-plugin-react-refresh/etc/plugin-react-refresh.api.md create mode 100644 packages/rspack-test-tools/api-extractor.json create mode 100644 packages/rspack-test-tools/etc/test-tools.api.md create mode 100644 packages/rspack/api-extractor.json create mode 100644 packages/rspack/etc/core.api.md delete mode 100644 packages/rspack/src/lib/ModuleFilenameHelpers.js rename packages/rspack/src/{ => lib}/ModuleFilenameHelpers.ts (100%) diff --git a/.github/workflows/reusable-build.yml b/.github/workflows/reusable-build.yml index 21c6a349912..02638320f2f 100644 --- a/.github/workflows/reusable-build.yml +++ b/.github/workflows/reusable-build.yml @@ -298,6 +298,15 @@ jobs: if: ${{ inputs.test-diff && !inputs.skipable }} run: pnpm run test:diff + - name: API change check + if: ${{ inputs.target == 'x86_64-unknown-linux-gnu' && !inputs.skipable }} + run: | + echo "====================================" + echo "Note: force build npm packages with \`pnpm build:js\` and \`pnpm api-extractor:local\` locally to generate API change if \`api-extractor\` check failed." + echo "$ pnpm build:js && pnpm api-extractor:local" + echo "====================================" + pnpm api-extractor:ci + ### write the latest metric into branch gh-pages ### Note that, We can't merge this script, because this script only runs on main branch - name: Update main branch test compatibility metric diff --git a/.gitignore b/.gitignore index a832a78bc54..9a0129e42d9 100644 --- a/.gitignore +++ b/.gitignore @@ -231,3 +231,9 @@ diff_output # .swc plugins cache .swc/ + +# api-extractor temp folder (https://api-extractor.com/pages/configs/api-extractor_json/#apireportreporttempfolder) +/packages/rspack/temp +/packages/rspack-dev-server/temp +/packages/rspack-plugin-react-refresh/temp +/packages/rspack-test-tools/temp diff --git a/.prettierignore b/.prettierignore index 8b6a33734f5..befafe67361 100644 --- a/.prettierignore +++ b/.prettierignore @@ -9,6 +9,7 @@ packages/rspack/src/config/schema.check.js # Ignore test related +packages/**/etc/**/* packages/rspack/tests/fixtures/**/* packages/rspack/tests/statsCases/**/* packages/rspack/tests/cases/**/* diff --git a/.vscode/settings.json b/.vscode/settings.json index 9a10ddb3e1f..29aded3baf4 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -25,7 +25,8 @@ "./crates/rspack_plugin_ensure_chunk_conditions/Cargo.toml" ], "files.associations": { - "*.snap": "markdown" + "*.snap": "markdown", + "*.json": "jsonc" }, "cSpell.words": [ "contextify", @@ -41,4 +42,4 @@ "ukey", "Ukey" ] -} \ No newline at end of file +} diff --git a/api-extractor.json b/api-extractor.json new file mode 100644 index 00000000000..d92f4e1be64 --- /dev/null +++ b/api-extractor.json @@ -0,0 +1,436 @@ +/** + * Config file for API Extractor. For more info, please visit: https://api-extractor.com + */ +{ + "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", + + /** + * Optionally specifies another JSON config file that this file extends from. This provides a way for + * standard settings to be shared across multiple projects. + * + * If the path starts with "./" or "../", the path is resolved relative to the folder of the file that contains + * the "extends" field. Otherwise, the first path segment is interpreted as an NPM package name, and will be + * resolved using NodeJS require(). + * + * SUPPORTED TOKENS: none + * DEFAULT VALUE: "" + */ + // "extends": "my-package/include/api-extractor-base.json" + + /** + * Determines the "" token that can be used with other config file settings. The project folder + * typically contains the tsconfig.json and package.json config files, but the path is user-defined. + * + * The path is resolved relative to the folder of the config file that contains the setting. + * + * The default value for "projectFolder" is the token "", which means the folder is determined by traversing + * parent folders, starting from the folder containing api-extractor.json, and stopping at the first folder + * that contains a tsconfig.json file. If a tsconfig.json file cannot be found in this way, then an error + * will be reported. + * + * SUPPORTED TOKENS: + * DEFAULT VALUE: "" + */ + // "projectFolder": "..", + + /** + * (REQUIRED) Specifies the .d.ts file to be used as the starting point for analysis. API Extractor + * analyzes the symbols exported by this module. + * + * The file extension must be ".d.ts" and not ".ts". + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * SUPPORTED TOKENS: , , + */ + "mainEntryPointFilePath": "/dist/index.d.ts", + + /** + * A list of NPM package names whose exports should be treated as part of this package. + * + * For example, suppose that Webpack is used to generate a distributed bundle for the project "library1", + * and another NPM package "library2" is embedded in this bundle. Some types from library2 may become part + * of the exported API for library1, but by default API Extractor would generate a .d.ts rollup that explicitly + * imports library2. To avoid this, we might specify: + * + * "bundledPackages": [ "library2" ], + * + * This would direct API Extractor to embed those types directly in the .d.ts rollup, as if they had been + * local files for library1. + * + * The "bundledPackages" elements may specify glob patterns using minimatch syntax. To ensure deterministic + * output, globs are expanded by matching explicitly declared top-level dependencies only. For example, + * the pattern below will NOT match "@my-company/example" unless it appears in a field such as "dependencies" + * or "devDependencies" of the project's package.json file: + * + * "bundledPackages": [ "@my-company/*" ], + */ + "bundledPackages": [], + + /** + * Specifies what type of newlines API Extractor should use when writing output files. By default, the output files + * will be written with Windows-style newlines. To use POSIX-style newlines, specify "lf" instead. + * To use the OS's default newline kind, specify "os". + * + * DEFAULT VALUE: "crlf" + */ + "newlineKind": "lf", + + /** + * Set to true when invoking API Extractor's test harness. When `testMode` is true, the `toolVersion` field in the + * .api.json file is assigned an empty string to prevent spurious diffs in output files tracked for tests. + * + * DEFAULT VALUE: "false" + */ + // "testMode": false, + + /** + * Specifies how API Extractor sorts members of an enum when generating the .api.json file. By default, the output + * files will be sorted alphabetically, which is "by-name". To keep the ordering in the source code, specify + * "preserve". + * + * DEFAULT VALUE: "by-name" + */ + "enumMemberOrder": "by-name", + + /** + * Determines how the TypeScript compiler engine will be invoked by API Extractor. + */ + "compiler": { + /** + * Specifies the path to the tsconfig.json file to be used by API Extractor when analyzing the project. + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * Note: This setting will be ignored if "overrideTsconfig" is used. + * + * SUPPORTED TOKENS: , , + * DEFAULT VALUE: "/tsconfig.json" + */ + "tsconfigFilePath": "/tsconfig.build.json" + /** + * Provides a compiler configuration that will be used instead of reading the tsconfig.json file from disk. + * The object must conform to the TypeScript tsconfig schema: + * + * http://json.schemastore.org/tsconfig + * + * If omitted, then the tsconfig.json file will be read from the "projectFolder". + * + * DEFAULT VALUE: no overrideTsconfig section + */ + // "overrideTsconfig": { + // . . . + // } + /** + * This option causes the compiler to be invoked with the --skipLibCheck option. This option is not recommended + * and may cause API Extractor to produce incomplete or incorrect declarations, but it may be required when + * dependencies contain declarations that are incompatible with the TypeScript engine that API Extractor uses + * for its analysis. Where possible, the underlying issue should be fixed rather than relying on skipLibCheck. + * + * DEFAULT VALUE: false + */ + // "skipLibCheck": true, + }, + + /** + * Configures how the API report file (*.api.md) will be generated. + */ + "apiReport": { + /** + * (REQUIRED) Whether to generate an API report. + */ + "enabled": true, + + /** + * The filename for the API report files. It will be combined with "reportFolder" or "reportTempFolder" to produce + * a full file path. + * + * The file extension should be ".api.md", and the string should not contain a path separator such as "\" or "/". + * + * SUPPORTED TOKENS: , + * DEFAULT VALUE: ".api.md" + */ + // "reportFileName": ".api.md", + + /** + * Specifies the folder where the API report file is written. The file name portion is determined by + * the "reportFileName" setting. + * + * The API report file is normally tracked by Git. Changes to it can be used to trigger a branch policy, + * e.g. for an API review. + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * SUPPORTED TOKENS: , , + * DEFAULT VALUE: "/temp/" + */ + "reportFolder": "/etc/", + + /** + * Specifies the folder where the temporary report file is written. The file name portion is determined by + * the "reportFileName" setting. + * + * After the temporary file is written to disk, it is compared with the file in the "reportFolder". + * If they are different, a production build will fail. + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * SUPPORTED TOKENS: , , + * DEFAULT VALUE: "/temp/" + */ + "reportTempFolder": "/temp/" + + /** + * Whether "forgotten exports" should be included in the API report file. Forgotten exports are declarations + * flagged with `ae-forgotten-export` warnings. See https://api-extractor.com/pages/messages/ae-forgotten-export/ to + * learn more. + * + * DEFAULT VALUE: "false" + */ + // "includeForgottenExports": false + }, + + /** + * Configures how the doc model file (*.api.json) will be generated. + */ + "docModel": { + /** + * (REQUIRED) Whether to generate a doc model file. + */ + "enabled": false + + /** + * The output path for the doc model file. The file extension should be ".api.json". + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * SUPPORTED TOKENS: , , + * DEFAULT VALUE: "/temp/.api.json" + */ + // "apiJsonFilePath": "/temp/.api.json", + + /** + * Whether "forgotten exports" should be included in the doc model file. Forgotten exports are declarations + * flagged with `ae-forgotten-export` warnings. See https://api-extractor.com/pages/messages/ae-forgotten-export/ to + * learn more. + * + * DEFAULT VALUE: "false" + */ + // "includeForgottenExports": false, + + /** + * The base URL where the project's source code can be viewed on a website such as GitHub or + * Azure DevOps. This URL path corresponds to the `` path on disk. + * + * This URL is concatenated with the file paths serialized to the doc model to produce URL file paths to individual API items. + * For example, if the `projectFolderUrl` is "https://github.com/microsoft/rushstack/tree/main/apps/api-extractor" and an API + * item's file path is "api/ExtractorConfig.ts", the full URL file path would be + * "https://github.com/microsoft/rushstack/tree/main/apps/api-extractor/api/ExtractorConfig.js". + * + * Can be omitted if you don't need source code links in your API documentation reference. + * + * SUPPORTED TOKENS: none + * DEFAULT VALUE: "" + */ + // "projectFolderUrl": "http://github.com/path/to/your/projectFolder" + }, + + /** + * Configures how the .d.ts rollup file will be generated. + */ + "dtsRollup": { + /** + * (REQUIRED) Whether to generate the .d.ts rollup file. + */ + "enabled": false + + /** + * Specifies the output path for a .d.ts rollup file to be generated without any trimming. + * This file will include all declarations that are exported by the main entry point. + * + * If the path is an empty string, then this file will not be written. + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * SUPPORTED TOKENS: , , + * DEFAULT VALUE: "/dist/.d.ts" + */ + // "untrimmedFilePath": "/dist/.d.ts", + + /** + * Specifies the output path for a .d.ts rollup file to be generated with trimming for an "alpha" release. + * This file will include only declarations that are marked as "@public", "@beta", or "@alpha". + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * SUPPORTED TOKENS: , , + * DEFAULT VALUE: "" + */ + // "alphaTrimmedFilePath": "/dist/-alpha.d.ts", + + /** + * Specifies the output path for a .d.ts rollup file to be generated with trimming for a "beta" release. + * This file will include only declarations that are marked as "@public" or "@beta". + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * SUPPORTED TOKENS: , , + * DEFAULT VALUE: "" + */ + // "betaTrimmedFilePath": "/dist/-beta.d.ts", + + /** + * Specifies the output path for a .d.ts rollup file to be generated with trimming for a "public" release. + * This file will include only declarations that are marked as "@public". + * + * If the path is an empty string, then this file will not be written. + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * SUPPORTED TOKENS: , , + * DEFAULT VALUE: "" + */ + // "publicTrimmedFilePath": "/dist/-public.d.ts", + + /** + * When a declaration is trimmed, by default it will be replaced by a code comment such as + * "Excluded from this release type: exampleMember". Set "omitTrimmingComments" to true to remove the + * declaration completely. + * + * DEFAULT VALUE: false + */ + // "omitTrimmingComments": true + }, + + /** + * Configures how the tsdoc-metadata.json file will be generated. + */ + "tsdocMetadata": { + /** + * Whether to generate the tsdoc-metadata.json file. + * + * DEFAULT VALUE: true + */ + "enabled": false + /** + * Specifies where the TSDoc metadata file should be written. + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * The default value is "", which causes the path to be automatically inferred from the "tsdocMetadata", + * "typings" or "main" fields of the project's package.json. If none of these fields are set, the lookup + * falls back to "tsdoc-metadata.json" in the package folder. + * + * SUPPORTED TOKENS: , , + * DEFAULT VALUE: "" + */ + // "tsdocMetadataFilePath": "/dist/tsdoc-metadata.json" + }, + + /** + * Configures how API Extractor reports error and warning messages produced during analysis. + * + * There are three sources of messages: compiler messages, API Extractor messages, and TSDoc messages. + */ + "messages": { + /** + * Configures handling of diagnostic messages reported by the TypeScript compiler engine while analyzing + * the input .d.ts files. + * + * TypeScript message identifiers start with "TS" followed by an integer. For example: "TS2551" + * + * DEFAULT VALUE: A single "default" entry with logLevel=warning. + */ + "compilerMessageReporting": { + /** + * Configures the default routing for messages that don't match an explicit rule in this table. + */ + "default": { + /** + * Specifies whether the message should be written to the the tool's output log. Note that + * the "addToApiReportFile" property may supersede this option. + * + * Possible values: "error", "warning", "none" + * + * Errors cause the build to fail and return a nonzero exit code. Warnings cause a production build fail + * and return a nonzero exit code. For a non-production build (e.g. when "api-extractor run" includes + * the "--local" option), the warning is displayed but the build will not fail. + * + * DEFAULT VALUE: "warning" + */ + "logLevel": "warning" + + /** + * When addToApiReportFile is true: If API Extractor is configured to write an API report file (.api.md), + * then the message will be written inside that file; otherwise, the message is instead logged according to + * the "logLevel" option. + * + * DEFAULT VALUE: false + */ + // "addToApiReportFile": false + } + + // "TS2551": { + // "logLevel": "warning", + // "addToApiReportFile": true + // }, + // + // . . . + }, + + /** + * Configures handling of messages reported by API Extractor during its analysis. + * + * API Extractor message identifiers start with "ae-". For example: "ae-extra-release-tag" + * + * DEFAULT VALUE: See api-extractor-defaults.json for the complete table of extractorMessageReporting mappings + */ + "extractorMessageReporting": { + "default": { + "logLevel": "warning" + // "addToApiReportFile": false + }, + "ae-missing-release-tag": { + "logLevel": "none" + } + + // "ae-extra-release-tag": { + // "logLevel": "warning", + // "addToApiReportFile": true + // }, + // + // . . . + }, + + /** + * Configures handling of messages reported by the TSDoc parser when analyzing code comments. + * + * TSDoc message identifiers start with "tsdoc-". For example: "tsdoc-link-tag-unescaped-text" + * + * DEFAULT VALUE: A single "default" entry with logLevel=warning. + */ + "tsdocMessageReporting": { + "default": { + "logLevel": "none" + // "addToApiReportFile": false + } + + // "tsdoc-link-tag-unescaped-text": { + // "logLevel": "warning", + // "addToApiReportFile": true + // }, + // + // . . . + } + } +} diff --git a/package.json b/package.json index 451f83c1a6b..92257416b43 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,9 @@ "test:ng": "pnpm --filter \"@rspack/test-tools\" test:ng", "test:e2e": "pnpm --filter \"@rspack-e2e/*\" test", "test:ci": "cross-env NODE_OPTIONS=--max_old_space_size=8192 pnpm run build:js && pnpm run test:unit && pnpm test:webpack", - "test:webpack": "pnpm --filter \"webpack-test\" test:metric" + "test:webpack": "pnpm --filter \"webpack-test\" test:metric", + "api-extractor:local": "pnpm --filter '@rspack/*' api-extractor --local", + "api-extractor:ci": "pnpm --filter '@rspack/*' api-extractor:ci" }, "homepage": "https://rspack.dev", "bugs": "https://github.com/web-infra-dev/rspack/issues", @@ -46,6 +48,7 @@ "pnpm": "8.14.3" }, "devDependencies": { + "@microsoft/api-extractor": "^7.43.1", "@rspack/cli": "workspace:*", "@taplo/cli": "^0.7.0", "@types/is-ci": "^3.0.4", diff --git a/packages/rspack-dev-server/api-extractor.json b/packages/rspack-dev-server/api-extractor.json new file mode 100644 index 00000000000..1e0238cd9f0 --- /dev/null +++ b/packages/rspack-dev-server/api-extractor.json @@ -0,0 +1,7 @@ +/** + * Config file for API Extractor. For more info, please visit: https://api-extractor.com + */ +{ + "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", + "extends": "../../api-extractor.json" +} diff --git a/packages/rspack-dev-server/etc/dev-server.api.md b/packages/rspack-dev-server/etc/dev-server.api.md new file mode 100644 index 00000000000..3f97d09cd2b --- /dev/null +++ b/packages/rspack-dev-server/etc/dev-server.api.md @@ -0,0 +1,39 @@ +## API Report File for "@rspack/dev-server" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +/// + +import { Compiler } from '@rspack/core'; +import { DevServer as Configuration } from '@rspack/core'; +import type { FSWatcher } from 'chokidar'; +import { MultiCompiler } from '@rspack/core'; +import type { Server } from 'http'; +import type { Socket } from 'net'; +import WebpackDevServer from 'webpack-dev-server'; + +export { Configuration } + +// @public (undocumented) +export class RspackDevServer extends WebpackDevServer { + constructor(options: Configuration, compiler: Compiler | MultiCompiler); + compiler: Compiler | MultiCompiler; + // (undocumented) + initialize(): Promise; + // Warning: (ae-forgotten-export) The symbol "ResolvedDevServer" needs to be exported by the entry point index.d.ts + options: ResolvedDevServer; + // (undocumented) + server: Server; + // (undocumented) + sockets: Socket[]; + // (undocumented) + staticWatchers: FSWatcher[]; + // (undocumented) + webSocketServer: WebpackDevServer.WebSocketServerImplementation | undefined; +} + +// (No @packageDocumentation comment for this package) + +``` diff --git a/packages/rspack-dev-server/package.json b/packages/rspack-dev-server/package.json index 7279249212e..97da4b8f670 100644 --- a/packages/rspack-dev-server/package.json +++ b/packages/rspack-dev-server/package.json @@ -16,7 +16,9 @@ "scripts": { "build": "tsc -b ./tsconfig.build.json", "dev": "tsc -w -b ./tsconfig.build.json", - "test": "rimraf .test-temp && jest --runInBand" + "test": "rimraf .test-temp && jest --runInBand", + "api-extractor": "api-extractor run --verbose", + "api-extractor:ci": "api-extractor run --verbose || diff temp/core.api.md etc/core.api.md" }, "files": [ "dist", diff --git a/packages/rspack-plugin-react-refresh/api-extractor.json b/packages/rspack-plugin-react-refresh/api-extractor.json new file mode 100644 index 00000000000..1e0238cd9f0 --- /dev/null +++ b/packages/rspack-plugin-react-refresh/api-extractor.json @@ -0,0 +1,7 @@ +/** + * Config file for API Extractor. For more info, please visit: https://api-extractor.com + */ +{ + "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", + "extends": "../../api-extractor.json" +} diff --git a/packages/rspack-plugin-react-refresh/etc/plugin-react-refresh.api.md b/packages/rspack-plugin-react-refresh/etc/plugin-react-refresh.api.md new file mode 100644 index 00000000000..c9b4e1aa2df --- /dev/null +++ b/packages/rspack-plugin-react-refresh/etc/plugin-react-refresh.api.md @@ -0,0 +1,17 @@ +## API Report File for "@rspack/plugin-react-refresh" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +// @public (undocumented) +export type PluginOptions = { + include?: string | RegExp | (string | RegExp)[] | null; + exclude?: string | RegExp | (string | RegExp)[] | null; + library?: string; + forceEnable?: boolean; +}; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/packages/rspack-plugin-react-refresh/package.json b/packages/rspack-plugin-react-refresh/package.json index e4d6e73359f..747c663d1ba 100644 --- a/packages/rspack-plugin-react-refresh/package.json +++ b/packages/rspack-plugin-react-refresh/package.json @@ -16,7 +16,9 @@ "scripts": { "build": "tsc -b ./tsconfig.build.json", "dev": "tsc -b -w", - "test": "jest --runInBand" + "test": "jest --runInBand", + "api-extractor": "api-extractor run --verbose", + "api-extractor:ci": "api-extractor run --verbose || diff temp/core.api.md etc/core.api.md" }, "files": [ "client", diff --git a/packages/rspack-test-tools/api-extractor.json b/packages/rspack-test-tools/api-extractor.json new file mode 100644 index 00000000000..1e0238cd9f0 --- /dev/null +++ b/packages/rspack-test-tools/api-extractor.json @@ -0,0 +1,7 @@ +/** + * Config file for API Extractor. For more info, please visit: https://api-extractor.com + */ +{ + "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", + "extends": "../../api-extractor.json" +} diff --git a/packages/rspack-test-tools/etc/test-tools.api.md b/packages/rspack-test-tools/etc/test-tools.api.md new file mode 100644 index 00000000000..34050435069 --- /dev/null +++ b/packages/rspack-test-tools/etc/test-tools.api.md @@ -0,0 +1,1132 @@ +## API Report File for "@rspack/test-tools" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +/// +/// + +import { Compiler } from '@rspack/core'; +import { Compiler as Compiler_2 } from 'webpack'; +import type { Configuration } from 'webpack'; +import EventEmitter from 'events'; +import { ITestCompilerManager as ITestCompilerManager_2 } from '../type'; +import { RspackOptions } from '@rspack/core'; +import { RspackOptionsNormalized } from '@rspack/core'; +import { RspackPluginInstance } from '@rspack/core'; +import { Stats } from '@rspack/core'; +import type { Stats as Stats_2 } from 'webpack'; +import { WebpackOptionsNormalized } from 'webpack'; + +// @public (undocumented) +export class BasicRunnerFactory implements TRunnerFactory { + constructor(name: string, context: ITestContext); + // (undocumented) + protected context: ITestContext; + // (undocumented) + create(file: string, compilerOptions: TCompilerOptions, env: ITestEnv): ITestRunner; + // (undocumented) + protected createRunner(file: string, compilerOptions: TCompilerOptions, env: ITestEnv): ITestRunner; + // (undocumented) + protected getRunnerKey(file: string): string; + // (undocumented) + protected name: string; +} + +// @public (undocumented) +export class BasicTaskProcessor implements ITestProcessor { + constructor(_options: IBasicProcessorOptions); + // (undocumented) + after(context: ITestContext): Promise; + // (undocumented) + afterAll(context: ITestContext): Promise; + // (undocumented) + before(context: ITestContext): Promise; + // (undocumented) + beforeAll(context: ITestContext): Promise; + // (undocumented) + build(context: ITestContext): Promise; + // (undocumented) + check(env: ITestEnv, context: ITestContext): Promise; + // (undocumented) + compiler(context: ITestContext): Promise; + // (undocumented) + config(context: ITestContext): Promise; + // (undocumented) + protected getCompiler(context: ITestContext): ITestCompilerManager_2; + // (undocumented) + protected _options: IBasicProcessorOptions; + // (undocumented) + run(env: ITestEnv, context: ITestContext): Promise; +} + +// @public (undocumented) +export function compareContent(sourceContent: string | false, distContent: string | false, compareOptions: ICompareOptions): TCompareResult; + +// @public (undocumented) +export function compareFile(sourceFile: string, distFile: string, compareOptions: ICompareOptions): TFileCompareResult; + +// @public (undocumented) +export function compareModules(modules: string[], sourceModules: Map, distModules: Map, compareOptions: ICompareOptions): TModuleCompareResult[]; + +// @public (undocumented) +export function createBuiltinCase(name: string, src: string, dist: string): void; + +// @public (undocumented) +export function createConfigCase(name: string, src: string, dist: string): void; + +// @public (undocumented) +export function createDefaultsCase(src: string): void; + +// @public (undocumented) +export function createDiagnosticCase(name: string, src: string, dist: string): void; + +// @public (undocumented) +export function createDiffCase(name: string, src: string, dist: string): void; + +// @public (undocumented) +export function createHashCase(name: string, src: string, dist: string): void; + +// @public (undocumented) +export function createHotCase(name: string, src: string, dist: string, target: TCompilerOptions["target"]): void; + +// @public (undocumented) +export function createNormalCase(name: string, src: string, dist: string): void; + +// @public (undocumented) +export function createStatsCase(name: string, src: string, dist: string): void; + +// @public (undocumented) +export function createTreeShakingCase(name: string, src: string, dist: string): void; + +// @public (undocumented) +export function createWatchCase(name: string, src: string, dist: string, temp: string): void; + +// @public (undocumented) +export class DefaultsConfigTaskProcessor extends SimpleTaskProcessor { + constructor(_defaultsConfigOptions: IDefaultsConfigProcessorOptions); + // (undocumented) + static addSnapshotSerializer(): void; + // (undocumented) + after(context: ITestContext): Promise; + // (undocumented) + afterAll(context: ITestContext): Promise; + // (undocumented) + before(context: ITestContext): Promise; + // (undocumented) + beforeAll(context: ITestContext): Promise; + // (undocumented) + build(context: ITestContext): Promise; + // (undocumented) + check(env: ITestEnv, context: ITestContext): Promise; + // (undocumented) + compiler(context: ITestContext): Promise; + // (undocumented) + protected _defaultsConfigOptions: IDefaultsConfigProcessorOptions; + // (undocumented) + protected getCompiler(context: ITestContext): ITestCompilerManager_2; + // (undocumented) + static getDefaultConfig(cwd: string, config: TCompilerOptions): TCompilerOptions; + // (undocumented) + run(env: ITestEnv, context: ITestContext): Promise; +} + +// @public (undocumented) +export function describeByWalk(name: string, sourceBase: string, distBase: string, createCase: (name: string, src: string, dist: string) => void, whitelist?: { + cat?: RegExp; + case?: RegExp; +}): void; + +// @public (undocumented) +export class DiffComparator { + constructor(options: IDiffComparatorOptions); + // (undocumented) + compare(): Promise; +} + +// @public (undocumented) +export class DiffHtmlReporter implements ITestReporter { + constructor(options: IDiffHtmlReporterOptions); + // (undocumented) + failure(id: string): Promise; + // (undocumented) + increment(id: string, data: TModuleCompareResult[]): Promise; + // (undocumented) + init(data?: TModuleCompareResult[]): Promise; + // (undocumented) + output(): Promise; +} + +// @public (undocumented) +export class DiffProcessor implements ITestProcessor { + constructor(options: IDiffProcessorOptions); + // (undocumented) + build(context: ITestContext): Promise; + // (undocumented) + check(env: ITestEnv, context: ITestContext): Promise; + // (undocumented) + compiler(context: ITestContext): Promise; + // (undocumented) + config(context: ITestContext): Promise; +} + +// @public (undocumented) +export class DiffStatsReporter implements ITestReporter { + constructor(options: IDiffStatsReporterOptions); + // (undocumented) + failure(id: string): Promise; + // (undocumented) + increment(id: string, data: TModuleCompareResult[]): Promise; + // (undocumented) + init(data?: TModuleCompareResult[]): Promise; + // (undocumented) + output(): Promise; +} + +// @public (undocumented) +export enum ECompareResultType { + // (undocumented) + Different = "different", + // (undocumented) + Missing = "missing", + // (undocumented) + OnlyDist = "only-dist", + // (undocumented) + OnlySource = "only-source", + // (undocumented) + Same = "same" +} + +// @public (undocumented) +export enum ECompilerType { + // (undocumented) + Rspack = "rspack", + // (undocumented) + Webpack = "webpack" +} + +// @public (undocumented) +export enum EEsmMode { + // (undocumented) + Evaluated = 1, + // (undocumented) + Unknown = 0, + // (undocumented) + Unlinked = 2 +} + +// @public (undocumented) +export function formatCode(name: string, raw: string, options: IFormatCodeOptions): string; + +// @public (undocumented) +export class HotRunnerFactory extends BasicRunnerFactory { + // (undocumented) + protected createRunner(file: string, compilerOptions: TCompilerOptions, env: ITestEnv): ITestRunner; +} + +// @public (undocumented) +export interface IBasicGlobalContext { + // (undocumented) + [key: string]: any; + // (undocumented) + clearTimeout: typeof clearTimeout; + // (undocumented) + console: Console; + // (undocumented) + expect: jest.Expect; + // (undocumented) + setTimeout: typeof setTimeout; +} + +// @public (undocumented) +export interface IBasicModuleScope extends ITestEnv { + // (undocumented) + [key: string]: any; + // (undocumented) + console: Console; + // (undocumented) + expect: jest.Expect; + // (undocumented) + jest: typeof jest; +} + +// @public (undocumented) +export interface IBasicProcessorOptions { + // (undocumented) + compilerType: T; + // (undocumented) + configFiles?: string[]; + // (undocumented) + defaultOptions?: (context: ITestContext) => TCompilerOptions; + // (undocumented) + findBundle?: (context: ITestContext, options: TCompilerOptions) => string[] | string | void; + // (undocumented) + name: string; + // (undocumented) + overrideOptions?: (context: ITestContext, options: TCompilerOptions) => void; + // (undocumented) + runable: boolean; +} + +// @public (undocumented) +export interface IBasicRunnerOptions { + // (undocumented) + compilerOptions: TCompilerOptions; + // (undocumented) + dist: string; + // (undocumented) + env: ITestEnv; + // (undocumented) + name: string; + // (undocumented) + runInNewContext?: boolean; + // (undocumented) + source: string; + // (undocumented) + stats?: TCompilerStats; + // (undocumented) + testConfig: TTestConfig; +} + +// @public (undocumented) +export interface ICompareOptions { + // (undocumented) + bootstrap?: boolean; + // (undocumented) + detail?: boolean; + // (undocumented) + format: IFormatCodeOptions; + // (undocumented) + modules?: TCompareModules; + // (undocumented) + renameModule?: (name: string) => string; + // (undocumented) + runtimeModules?: TCompareModules; +} + +// @public (undocumented) +export interface IDefaultsConfigProcessorOptions { + // (undocumented) + cwd?: string; + // (undocumented) + diff: (diff: any, defaults: any) => Promise; + // (undocumented) + name: string; + // (undocumented) + options?: (context: ITestContext) => TCompilerOptions; +} + +// @public (undocumented) +export interface IDiffComparatorOptions { + // (undocumented) + bootstrap?: boolean; + // (undocumented) + files: string[]; + // (undocumented) + formatOptions?: IFormatCodeOptions; + // (undocumented) + modules?: TCompareModules; + // (undocumented) + reporters: ITestReporter[]; + // (undocumented) + rspackDist: string; + // (undocumented) + runtimeModules?: TCompareModules; + // (undocumented) + webpackDist: string; +} + +// @public (undocumented) +export interface IDiffHtmlReporterOptions { + // (undocumented) + dist: string; + // (undocumented) + ignore?: RegExp; +} + +// @public (undocumented) +export interface IDiffProcessorOptions extends IFormatCodeOptions { + // (undocumented) + bootstrap?: boolean; + // (undocumented) + detail?: boolean; + // (undocumented) + files?: string[]; + // (undocumented) + modules?: TCompareModules; + // (undocumented) + onCompareFile?: (file: string, result: TFileCompareResult) => void; + // (undocumented) + onCompareModules?: (file: string, results: TModuleCompareResult[]) => void; + // (undocumented) + onCompareRuntimeModules?: (file: string, results: TModuleCompareResult[]) => void; + // (undocumented) + rspackPath: string; + // (undocumented) + runtimeModules?: TCompareModules; + // (undocumented) + webpackPath: string; +} + +// @public (undocumented) +export interface IDiffStatsReporterOptions { + // (undocumented) + file: string; + // (undocumented) + footer?: string[]; + // (undocumented) + header?: string[]; + // (undocumented) + report?: boolean; +} + +// @public (undocumented) +export interface IFormatCodeOptions { + // (undocumented) + ignoreBlockOnlyStatement: boolean; + // (undocumented) + ignoreCssFilePath: boolean; + // (undocumented) + ignoreIfCertainCondition: boolean; + // (undocumented) + ignoreModuleArguments: boolean; + // (undocumented) + ignoreModuleId: boolean; + // (undocumented) + ignoreObjectPropertySequence: boolean; + // (undocumented) + ignorePropertyQuotationMark: boolean; + // (undocumented) + ignoreSwcHelpersPath: boolean; + // (undocumented) + replacements?: Record; +} + +// @public (undocumented) +export interface IMultiTaskProcessorOptions { + // (undocumented) + compilerType: ECompilerType.Rspack; + // (undocumented) + configFiles?: string[]; + // (undocumented) + defaultOptions?: (index: number, context: ITestContext) => TCompilerOptions; + // (undocumented) + findBundle?: (index: number, context: ITestContext, options: TCompilerOptions) => string[] | string | void; + // (undocumented) + name: string; + // (undocumented) + overrideOptions?: (index: number, context: ITestContext, options: TCompilerOptions) => void; + // (undocumented) + runable: boolean; +} + +// @public (undocumented) +export interface IRspackBuiltinProcessorOptions { + // (undocumented) + name: string; + // (undocumented) + snapshot: string; + // (undocumented) + snapshotFileFilter?: ISnapshotProcessorOptions["snapshotFileFilter"]; +} + +// @public (undocumented) +export interface IRspackConfigProcessorOptions { + // (undocumented) + name: string; + // (undocumented) + runable: boolean; +} + +// @public (undocumented) +export interface IRspackDiagnosticProcessorOptions { + // (undocumented) + name: string; + // (undocumented) + root: string; +} + +// @public (undocumented) +export interface IRspackHashProcessorOptions { + // (undocumented) + name: string; +} + +// @public (undocumented) +export interface IRspackHotProcessorOptions { + // (undocumented) + name: string; + // (undocumented) + target: TCompilerOptions["target"]; +} + +// @public (undocumented) +export interface IRspackStatsProcessorOptions { + // (undocumented) + name: string; +} + +// @public (undocumented) +export interface IRspackWatchProcessorOptions { + // Warning: (ae-forgotten-export) The symbol "TRspackExperiments" needs to be exported by the entry point index.d.ts + // + // (undocumented) + experiments?: TRspackExperiments; + // (undocumented) + name: string; + // Warning: (ae-forgotten-export) The symbol "TRspackOptimization" needs to be exported by the entry point index.d.ts + // + // (undocumented) + optimization?: TRspackOptimization; + // (undocumented) + runable: boolean; + // (undocumented) + stepName: string; + // (undocumented) + tempDir: string; +} + +// @public (undocumented) +export interface IRspackWatchStepProcessorOptions { + // (undocumented) + name: string; + // (undocumented) + runable: boolean; + // (undocumented) + stepName: string; + // (undocumented) + tempDir: string; +} + +// @public (undocumented) +export const isDirectory: (p: string) => boolean; + +// @public (undocumented) +export interface ISimpleProcessorOptions { + // (undocumented) + build?: (context: ITestContext, compiler: TCompiler) => Promise; + // (undocumented) + check?: (context: ITestContext, compiler: TCompiler, stats: TCompilerStats) => Promise; + // (undocumented) + compiler?: (context: ITestContext, compiler: TCompiler) => Promise; + // (undocumented) + compilerType: T; + // (undocumented) + name: string; + // (undocumented) + options?: (context: ITestContext) => TCompilerOptions; +} + +// @public (undocumented) +export interface ISnapshotProcessorOptions extends IBasicProcessorOptions { + // (undocumented) + snapshot: string; + // (undocumented) + snapshotFileFilter?: (file: string) => boolean; +} + +// @public (undocumented) +export interface IStatsAPITaskProcessorOptions { + // (undocumented) + build?: (context: ITestContext, compiler: TCompiler) => Promise; + // (undocumented) + check?: (stats: TCompilerStats, compiler: TCompiler) => Promise; + // (undocumented) + compilerType: T; + // (undocumented) + cwd?: string; + // (undocumented) + name: string; + // (undocumented) + options?: (context: ITestContext) => TCompilerOptions; +} + +// @public (undocumented) +export const isValidCaseDirectory: (name: string) => boolean; + +// @public (undocumented) +export interface ITestCompilerManager { + // (undocumented) + build(): Promise>; + // (undocumented) + close(): Promise; + // (undocumented) + createCompiler(): TCompiler; + // (undocumented) + getCompiler(): TCompiler | null; + // (undocumented) + getEmitter(): EventEmitter; + // (undocumented) + getOptions(): TCompilerOptions; + // (undocumented) + getStats(): TCompilerStats | null; + // (undocumented) + mergeOptions(newOptions: TCompilerOptions): TCompilerOptions; + // (undocumented) + setOptions(newOptions: TCompilerOptions): TCompilerOptions; + // (undocumented) + watch(timeout?: number): void; +} + +// @public (undocumented) +export interface ITestContext { + // (undocumented) + clearError(name?: string): void; + // (undocumented) + emitError(name: string, err: Error | string): void; + // (undocumented) + getCompiler(name: string, type: T | void): ITestCompilerManager; + // (undocumented) + getDist(sub?: string): string; + // (undocumented) + getError(name?: string): Error[]; + // (undocumented) + getNames(): string[]; + // (undocumented) + getRunner(key: string): ITestRunner | null; + // (undocumented) + getRunnerFactory(name: string): TRunnerFactory | null; + // (undocumented) + getSource(sub?: string): string; + // (undocumented) + getTemp(sub?: string): string | null; + // (undocumented) + getTestConfig(): TTestConfig; + // (undocumented) + getValue(name: string, key: string): T | void; + // (undocumented) + hasError(name?: string): boolean; + // (undocumented) + setRunner(key: string, runner: ITestRunner): void; + // (undocumented) + setValue(name: string, key: string, value: T): void; +} + +// @public (undocumented) +export interface ITestEnv { + // (undocumented) + afterEach: (...args: any[]) => void; + // (undocumented) + beforeEach: (...args: any[]) => void; + // (undocumented) + it: (...args: any[]) => void; +} + +// @public (undocumented) +export interface ITester { + // (undocumented) + check(env: ITestEnv): Promise; + // (undocumented) + compile(): Promise; + // (undocumented) + next(): boolean; + // (undocumented) + prepare(): Promise; + // (undocumented) + resume(): Promise; + // (undocumented) + step: number; + // (undocumented) + total: number; +} + +// @public (undocumented) +export interface ITesterConfig { + // (undocumented) + dist: string; + // (undocumented) + name: string; + // (undocumented) + runnerFactory?: new (name: string, context: ITestContext) => TRunnerFactory; + // (undocumented) + src: string; + // (undocumented) + steps?: ITestProcessor[]; + // (undocumented) + temp?: string; + // (undocumented) + testConfig?: TTestConfig; +} + +// @public (undocumented) +export interface ITestLoader { + // (undocumented) + walk(): Promise; +} + +// @public (undocumented) +export interface ITestProcessor { + // (undocumented) + after?(context: ITestContext): Promise; + // (undocumented) + afterAll?(context: ITestContext): Promise; + // (undocumented) + before?(context: ITestContext): Promise; + // (undocumented) + beforeAll?(context: ITestContext): Promise; + // (undocumented) + build?(context: ITestContext): Promise; + // (undocumented) + check?(env: ITestEnv, context: ITestContext): Promise; + // (undocumented) + compiler?(context: ITestContext): Promise; + // (undocumented) + config?(context: ITestContext): Promise; + // (undocumented) + run?(env: ITestEnv, context: ITestContext): Promise; +} + +// @public (undocumented) +export interface ITestReporter { + // (undocumented) + failure(id: string): Promise; + // (undocumented) + increment(id: string, data: T): Promise; + // (undocumented) + init(data?: T): Promise; + // (undocumented) + output(): Promise; +} + +// @public (undocumented) +export interface ITestRunner { + // (undocumented) + getRequire(): TRunnerRequirer; + // (undocumented) + run(file: string): Promise; +} + +// @public (undocumented) +export class MultipleRunnerFactory extends BasicRunnerFactory { + // (undocumented) + protected createRunner(file: string, compilerOptions: TCompilerOptions, env: ITestEnv): ITestRunner; + // (undocumented) + protected getFileIndexHandler(file: string): { + getIndex: () => number[]; + flagIndex: () => Set; + }; + // (undocumented) + protected getRunnerKey(file: string): string; + // (undocumented) + protected runned: Set; +} + +// @public (undocumented) +export class MultiTaskProcessor extends BasicTaskProcessor implements ITestProcessor { + constructor(_multiOptions: IMultiTaskProcessorOptions); + // (undocumented) + config(context: ITestContext): Promise; + // (undocumented) + protected multiCompilerOptions: TCompilerOptions[]; + // (undocumented) + protected _multiOptions: IMultiTaskProcessorOptions; +} + +// @public (undocumented) +export class NormalRunnerFactory extends BasicRunnerFactory { + // (undocumented) + protected createRunner(file: string, compilerOptions: TCompilerOptions, env: ITestEnv): ITestRunner; +} + +// @public (undocumented) +export function parseModules(content: string, options?: { + bootstrap?: boolean; +}): { + modules: Map; + runtimeModules: Map; +}; + +// @public (undocumented) +export function readConfigFile(files: string[]): TCompilerOptions[]; + +// @public (undocumented) +export function replaceModuleArgument(raw: string): string; + +// @public (undocumented) +export function replaceRuntimeModuleName(raw: string): string; + +// @public (undocumented) +export class RspackBuiltinProcessor extends SnapshotProcessor { + constructor(_builtinOptions: IRspackBuiltinProcessorOptions); + // (undocumented) + protected _builtinOptions: IRspackBuiltinProcessorOptions; + // (undocumented) + static defaultOptions(context: ITestContext): TCompilerOptions; +} + +// @public (undocumented) +export class RspackConfigProcessor extends MultiTaskProcessor { + constructor(options: IRspackConfigProcessorOptions); + // (undocumented) + static defaultOptions(index: number, context: ITestContext): TCompilerOptions; + // (undocumented) + static findBundle(index: number, context: ITestContext, options: TCompilerOptions): string | string[] | undefined; + // (undocumented) + static overrideOptions(index: number, context: ITestContext, options: TCompilerOptions): void; +} + +// @public (undocumented) +export class RspackDiagnosticProcessor extends BasicTaskProcessor { + constructor(_diagnosticOptions: IRspackDiagnosticProcessorOptions); + // (undocumented) + after(context: ITestContext): Promise; + // (undocumented) + before(context: ITestContext): Promise; + // (undocumented) + check(env: ITestEnv, context: ITestContext): Promise; + // (undocumented) + static defaultOptions(context: ITestContext): TCompilerOptions; + // (undocumented) + protected _diagnosticOptions: IRspackDiagnosticProcessorOptions; +} + +// @public (undocumented) +export class RspackDiffConfigPlugin implements RspackPluginInstance { + constructor(modifier?: ((options: RspackOptionsNormalized) => RspackOptionsNormalized) | undefined); + // (undocumented) + apply(compiler: Compiler): void; + // (undocumented) + name: string; +} + +// @public (undocumented) +export class RspackHashProcessor extends MultiTaskProcessor { + constructor(options: IRspackHashProcessorOptions); + // (undocumented) + check(env: ITestEnv, context: ITestContext): Promise; + // (undocumented) + static defaultOptions(index: number, context: ITestContext): TCompilerOptions; + // (undocumented) + static overrideOptions(index: number, context: ITestContext, options: TCompilerOptions): void; +} + +// @public (undocumented) +export class RspackHotProcessor extends BasicTaskProcessor { + constructor(_hotOptions: IRspackHotProcessorOptions); + // (undocumented) + static defaultOptions(hotOptions: IRspackHotProcessorOptions, updateOptions: TUpdateOptions): IBasicProcessorOptions["defaultOptions"]; + // (undocumented) + static findBundle(hotOptions: IRspackHotProcessorOptions): IBasicProcessorOptions["findBundle"]; + // (undocumented) + protected _hotOptions: IRspackHotProcessorOptions; + // (undocumented) + static overrideOptions(hotOptions: IRspackHotProcessorOptions, updateOptions: TUpdateOptions): IBasicProcessorOptions["overrideOptions"]; + // (undocumented) + run(env: ITestEnv, context: ITestContext): Promise; + // (undocumented) + protected runner: ITestRunner | null; + // Warning: (ae-forgotten-export) The symbol "TUpdateOptions" needs to be exported by the entry point index.d.ts + // + // (undocumented) + protected updateOptions: TUpdateOptions; +} + +// @public (undocumented) +export class RspackStatsProcessor extends MultiTaskProcessor { + constructor(options: IRspackStatsProcessorOptions); + // (undocumented) + after(context: ITestContext): Promise; + // (undocumented) + before(context: ITestContext): Promise; + // (undocumented) + check(env: ITestEnv, context: ITestContext): Promise; + // (undocumented) + compiler(context: ITestContext): Promise; + // (undocumented) + static defaultOptions(index: number, context: ITestContext): TCompilerOptions; + // (undocumented) + static overrideOptions(index: number, context: ITestContext, options: TCompilerOptions): void; +} + +// @public (undocumented) +export class RspackWatchProcessor extends MultiTaskProcessor { + constructor(_watchOptions: IRspackWatchProcessorOptions); + // (undocumented) + build(context: ITestContext): Promise; + // (undocumented) + check(env: ITestEnv, context: ITestContext): Promise; + // (undocumented) + compiler(context: ITestContext): Promise; + // (undocumented) + protected currentTriggerFilename: string | null; + // (undocumented) + protected lastHash: string | null; + // (undocumented) + static overrideOptions({ tempDir, name, experiments, optimization }: IRspackWatchProcessorOptions): (index: number, context: ITestContext, options: TCompilerOptions) => void; + // (undocumented) + run(env: ITestEnv, context: ITestContext): Promise; + // (undocumented) + protected _watchOptions: IRspackWatchProcessorOptions; +} + +// @public (undocumented) +export class RspackWatchStepProcessor extends RspackWatchProcessor { + constructor(_watchOptions: IRspackWatchStepProcessorOptions); + // (undocumented) + build(context: ITestContext): Promise; + // (undocumented) + compiler(context: ITestContext): Promise; + // (undocumented) + protected _watchOptions: IRspackWatchStepProcessorOptions; +} + +// @public (undocumented) +export class SimpleTaskProcessor implements ITestProcessor { + constructor(_options: ISimpleProcessorOptions); + // (undocumented) + after(context: ITestContext): Promise; + // (undocumented) + afterAll(context: ITestContext): Promise; + // (undocumented) + before(context: ITestContext): Promise; + // (undocumented) + beforeAll(context: ITestContext): Promise; + // (undocumented) + build(context: ITestContext): Promise; + // (undocumented) + check(env: ITestEnv, context: ITestContext): Promise; + // (undocumented) + compiler(context: ITestContext): Promise; + // (undocumented) + config(context: ITestContext): Promise; + // (undocumented) + protected getCompiler(context: ITestContext): ITestCompilerManager_2; + // (undocumented) + protected _options: ISimpleProcessorOptions; + // (undocumented) + run(env: ITestEnv, context: ITestContext): Promise; +} + +// @public (undocumented) +export class SnapshotProcessor extends BasicTaskProcessor { + constructor(_snapshotOptions: ISnapshotProcessorOptions); + // (undocumented) + check(env: ITestEnv, context: ITestContext): Promise; + // (undocumented) + protected _snapshotOptions: ISnapshotProcessorOptions; +} + +// @public (undocumented) +export class StatsAPITaskProcessor extends SimpleTaskProcessor { + constructor(_statsAPIOptions: IStatsAPITaskProcessorOptions); + // (undocumented) + static addSnapshotSerializer(): void; + // (undocumented) + after(context: ITestContext): Promise; + // (undocumented) + before(context: ITestContext): Promise; + // (undocumented) + check(env: ITestEnv, context: ITestContext): Promise; + // (undocumented) + compiler(context: ITestContext): Promise; + // (undocumented) + run(env: ITestEnv, context: ITestContext): Promise; + // (undocumented) + protected _statsAPIOptions: IStatsAPITaskProcessorOptions; +} + +// @public (undocumented) +export type TBasicRunnerFile = { + path: string; + content: string; + subPath: string; +}; + +// @public (undocumented) +export type TCaseSummary = Record; + +// @public (undocumented) +export type TCaseSummaryId = `${TCompilerTypeId}|${TModuleTypeId}|${TDimenTypeId}`; + +// @public (undocumented) +export type TCompareModules = string[] | true; + +// @public (undocumented) +export type TCompareResult = { + type: ECompareResultType; + detail?: unknown; + source?: string; + dist?: string; + lines?: { + common: number; + source: number; + dist: number; + }; +}; + +// @public (undocumented) +export type TCompiler = T extends ECompilerType.Rspack ? Compiler : Compiler_2; + +// @public (undocumented) +export type TCompilerFactory = (options: TCompilerOptions | TCompilerOptions[]) => TCompiler; + +// @public (undocumented) +export type TCompilerOptions = T extends ECompilerType.Rspack ? RspackOptions : Configuration; + +// @public (undocumented) +export type TCompilerStats = T extends ECompilerType.Rspack ? Stats : Stats_2; + +// @public (undocumented) +export type TCompilerTypeId = ECompilerType.Rspack | ECompilerType.Webpack | "common"; + +// @public (undocumented) +export type TDiffStats = { + root: string; + data: Array; +}; + +// @public (undocumented) +export type TDiffStatsItem = { + name: string; + source: string; + dist: string; + type: ECompareResultType; +}; + +// @public (undocumented) +export type TDimenTypeId = "modules" | "lines" | "lines-in-common"; + +// @public (undocumented) +export class TestContext implements ITestContext { + constructor(config: TTestContextOptions); + // (undocumented) + clearError(name?: string): void; + // (undocumented) + protected compilers: Map>; + // (undocumented) + emitError(name: string, err: Error | string): void; + // (undocumented) + protected errors: Map; + // (undocumented) + getCompiler(name: string, type: T | void): ITestCompilerManager; + // (undocumented) + getDist(sub?: string): string; + // (undocumented) + getError(name?: string): Error[]; + // (undocumented) + getNames(): string[]; + // (undocumented) + getRunner(key: string): ITestRunner | null; + // (undocumented) + getRunnerFactory(name: string): TRunnerFactory | null; + // (undocumented) + getSource(sub?: string): string; + // (undocumented) + getTemp(sub?: string): string | null; + // (undocumented) + getTestConfig(): TTestConfig; + // (undocumented) + getValue(name: string, key: string): T | void; + // (undocumented) + hasError(name?: string): boolean; + // (undocumented) + protected runnerFactory: TRunnerFactory | null; + // (undocumented) + protected runners: Map; + // (undocumented) + setRunner(key: string, runner: ITestRunner): void; + // (undocumented) + setValue(name: string, key: string, value: T): void; + // (undocumented) + protected store: Map>; +} + +// @public (undocumented) +export class Tester implements ITester { + constructor(config: ITesterConfig); + // (undocumented) + check(env: ITestEnv): Promise; + // (undocumented) + compile(): Promise; + // (undocumented) + next(): boolean; + // (undocumented) + prepare(): Promise; + // (undocumented) + resume(): Promise; + // (undocumented) + step: number; + // (undocumented) + total: number; +} + +// @public (undocumented) +export type TFileCompareResult = TCompareResult & { + file: { + source: string; + dist: string; + }; + modules: Partial>; +}; + +// @public (undocumented) +export type TModuleCompareResult = TCompareResult & { + name: string; +}; + +// @public (undocumented) +export type TModuleTypeId = "normal" | "runtime"; + +// @public (undocumented) +export interface TRunnerFactory { + // (undocumented) + create(file: string, compilerOptions: TCompilerOptions, env: ITestEnv): ITestRunner; +} + +// @public (undocumented) +export type TRunnerRequirer = (currentDirectory: string, modulePath: string[] | string, context?: { + file?: TBasicRunnerFile; + esmMode?: EEsmMode; +}) => Object | Promise; + +// @public (undocumented) +export type TTestConfig = { + validate?: (stats: TCompilerStats, stderr?: string) => void; + noTest?: boolean; + beforeExecute?: () => void; + afterExecute?: () => void; + moduleScope?: (ms: IBasicModuleScope) => IBasicModuleScope; + findBundle?: (index: number, options: TCompilerOptions) => string | string[]; + bundlePath?: string[]; + nonEsmThis?: (p: string | string[]) => Object; + modules?: Record; + timeout?: number; +}; + +// @public (undocumented) +export type TTestContextOptions = Omit; + +// @public (undocumented) +export type TTestFilter = (creatorConfig: Record, testConfig: TTestConfig) => boolean | string; + +// @public (undocumented) +export type TTestRunResult = Record; + +// @public (undocumented) +export class WatchRunnerFactory extends BasicRunnerFactory { + // (undocumented) + protected createRunner(file: string, compilerOptions: TCompilerOptions, env: ITestEnv): ITestRunner; + // (undocumented) + protected getRunnerKey(file: string): string; +} + +// @public (undocumented) +export class WebpackDiffConfigPlugin { + constructor(modifier?: ((options: WebpackOptionsNormalized) => WebpackOptionsNormalized) | undefined); + // (undocumented) + apply(compiler: Compiler_2): void; + // (undocumented) + name: string; +} + +// @public (undocumented) +export class WebpackModulePlaceholderPlugin { + constructor(); + // (undocumented) + apply(compiler: any): void; +} + +// (No @packageDocumentation comment for this package) + +``` diff --git a/packages/rspack-test-tools/package.json b/packages/rspack-test-tools/package.json index 5a30cfbbb99..e7b3be781f6 100644 --- a/packages/rspack-test-tools/package.json +++ b/packages/rspack-test-tools/package.json @@ -18,7 +18,9 @@ "dev": "tsc -b -w", "test": "cross-env NO_COLOR=1 node --expose-gc --max-old-space-size=8192 --experimental-vm-modules ../../node_modules/jest-cli/bin/jest --logHeapUsage --config ./jest.config.compat.js", "test:ng": "cross-env SNAPSHOT=legacy NO_COLOR=1 node --expose-gc --max-old-space-size=8192 --experimental-vm-modules ../../node_modules/jest-cli/bin/jest --logHeapUsage --config ./jest.config.legacy.js", - "test:diff": "cross-env RSPACK_DIFF=true NO_COLOR=1 node --expose-gc --max-old-space-size=8192 --experimental-vm-modules ../../node_modules/jest-cli/bin/jest --logHeapUsage --config ./jest.config.diff.js" + "test:diff": "cross-env RSPACK_DIFF=true NO_COLOR=1 node --expose-gc --max-old-space-size=8192 --experimental-vm-modules ../../node_modules/jest-cli/bin/jest --logHeapUsage --config ./jest.config.diff.js", + "api-extractor": "api-extractor run --verbose", + "api-extractor:ci": "api-extractor run --verbose || diff temp/core.api.md etc/core.api.md" }, "files": [ "client", diff --git a/packages/rspack/api-extractor.json b/packages/rspack/api-extractor.json new file mode 100644 index 00000000000..1e0238cd9f0 --- /dev/null +++ b/packages/rspack/api-extractor.json @@ -0,0 +1,7 @@ +/** + * Config file for API Extractor. For more info, please visit: https://api-extractor.com + */ +{ + "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", + "extends": "../../api-extractor.json" +} diff --git a/packages/rspack/etc/core.api.md b/packages/rspack/etc/core.api.md new file mode 100644 index 00000000000..f39eafd089f --- /dev/null +++ b/packages/rspack/etc/core.api.md @@ -0,0 +1,5001 @@ +## API Report File for "@rspack/core" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +/// + +import { AsyncSeriesBailHook as AsyncSeriesBailHook_2 } from 'tapable'; +import { AsyncSeriesHook as AsyncSeriesHook_2 } from 'tapable'; +import * as binding from '@rspack/binding'; +import { BuiltinPlugin } from '@rspack/binding'; +import { BuiltinPluginName } from '@rspack/binding'; +import Cache_2 = require('./lib/Cache'); +import CacheFacade = require('./lib/CacheFacade'); +import { Callback as Callback_2 } from 'tapable'; +import { Compiler as Compiler_2 } from '../Compiler'; +import { RawEvalDevToolModulePluginOptions as EvalDevToolModulePluginOptions } from '@rspack/binding'; +import { cleanupGlobalTrace as experimental_cleanupGlobalTrace } from '@rspack/binding'; +import { registerGlobalTrace as experimental_registerGlobalTrace } from '@rspack/binding'; +import { exports as exports_2 } from './exports'; +import type { ExternalObject } from '@rspack/binding'; +import { fs } from 'fs'; +import Hash = require('../util/hash'); +import { HookMap as HookMap_2 } from 'tapable'; +import { JsAssetInfo } from '@rspack/binding'; +import { JsChunk } from '@rspack/binding'; +import { JsChunkGroup } from '@rspack/binding'; +import { JsCodegenerationResult } from '@rspack/binding'; +import { JsCompilation } from '@rspack/binding'; +import { JsCreateData } from '@rspack/binding'; +import { JsLoaderContext } from '@rspack/binding'; +import { JsLoaderResult } from '@rspack/binding'; +import { JsModule } from '@rspack/binding'; +import type { JsRuntimeModule } from '@rspack/binding'; +import { JsStats } from '@rspack/binding'; +import type { JsStatsChunk } from '@rspack/binding'; +import { JsStatsError } from '@rspack/binding'; +import { JsStatsWarning } from '@rspack/binding'; +import { libCacheFacade } from './lib/CacheFacade'; +import { LoaderContext as LoaderContext_2 } from './config'; +import { Logger as Logger_2 } from './logging/Logger'; +import { MultiHook } from 'tapable'; +import { PathData } from '@rspack/binding'; +import { PathWithInfo } from '@rspack/binding'; +import { RawBannerPluginOptions } from '@rspack/binding'; +import { RawBuiltins } from '@rspack/binding'; +import { RawBundlerInfoPluginOptions } from '@rspack/binding'; +import { RawCopyPattern } from '@rspack/binding'; +import { RawCopyRspackPluginOptions } from '@rspack/binding'; +import type { RawCssExtractPluginOption } from '@rspack/binding'; +import { RawEntryPluginOptions } from '@rspack/binding'; +import { RawExternalsPluginOptions } from '@rspack/binding'; +import { RawFuncUseCtx } from '@rspack/binding'; +import { RawHtmlRspackPluginOptions } from '@rspack/binding'; +import { RawHttpExternalsRspackPluginOptions } from '@rspack/binding'; +import { RawIgnorePluginOptions } from '@rspack/binding'; +import type { RawLibraryOptions } from '@rspack/binding'; +import { RawLimitChunkCountPluginOptions } from '@rspack/binding'; +import type { RawOptions } from '@rspack/binding'; +import { RawProgressPluginOptions } from '@rspack/binding'; +import { RawSourceMapDevToolPluginOptions } from '@rspack/binding'; +import { RawSwcJsMinimizerRspackPluginOptions } from '@rspack/binding'; +import { ResolveRequest } from 'enhanced-resolve'; +import ResolverFactory = require('./ResolverFactory'); +import { rspack as rspack_3 } from './rspack'; +import { RspackOptionsNormalized as RspackOptionsNormalized_2 } from '.'; +import { Source } from 'webpack-sources'; +import { SyncBailHook as SyncBailHook_2 } from 'tapable'; +import { SyncHook as SyncHook_2 } from 'tapable'; +import { SyncWaterfallHook } from 'tapable'; +import * as tapable from 'tapable'; +import { UnsetAdditionalOptions as UnsetAdditionalOptions_2 } from 'tapable'; +import type { WatchOptions as WatchOptions_2 } from 'watchpack'; +import type * as webpackDevServer from 'webpack-dev-server'; +import { z } from 'zod'; + +// Warning: (ae-forgotten-export) The symbol "amdContainer" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type AmdContainer = z.infer; + +// @public (undocumented) +export const applyRspackOptionsBaseDefaults: (options: RspackOptionsNormalized) => void; + +// @public (undocumented) +export const applyRspackOptionsDefaults: (options: RspackOptionsNormalized) => void; + +// @public (undocumented) +export interface Asset { + // (undocumented) + info: JsAssetInfo; + // (undocumented) + name: string; + // (undocumented) + source: Source; +} + +// Warning: (ae-forgotten-export) The symbol "assetGeneratorDataUrl" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type AssetGeneratorDataUrl = z.infer; + +// Warning: (ae-forgotten-export) The symbol "assetGeneratorDataUrlFunction" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type AssetGeneratorDataUrlFunction = z.infer; + +// Warning: (ae-forgotten-export) The symbol "assetGeneratorDataUrlOptions" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type AssetGeneratorDataUrlOptions = z.infer; + +// Warning: (ae-forgotten-export) The symbol "assetGeneratorOptions" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type AssetGeneratorOptions = z.infer; + +// @public (undocumented) +export type AssetInfo = Partial & Record; + +// Warning: (ae-forgotten-export) The symbol "assetInlineGeneratorOptions" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type AssetInlineGeneratorOptions = z.infer; + +// Warning: (ae-forgotten-export) The symbol "assetModuleFilename" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type AssetModuleFilename = z.infer; + +// Warning: (ae-forgotten-export) The symbol "assetParserDataUrl" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type AssetParserDataUrl = z.infer; + +// Warning: (ae-forgotten-export) The symbol "assetParserDataUrlOptions" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type AssetParserDataUrlOptions = z.infer; + +// Warning: (ae-forgotten-export) The symbol "assetParserOptions" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type AssetParserOptions = z.infer; + +// Warning: (ae-forgotten-export) The symbol "assetResourceGeneratorOptions" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type AssetResourceGeneratorOptions = z.infer; + +// @public (undocumented) +export type Assets = Record; + +// Warning: (ae-forgotten-export) The symbol "asyncChunks" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type AsyncChunks = z.infer; + +// Warning: (ae-forgotten-export) The symbol "auxiliaryComment" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type AuxiliaryComment = z.infer; + +// Warning: (ae-forgotten-export) The symbol "bail" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type Bail = z.infer; + +// @public (undocumented) +export const BannerPlugin: { + new (args: string | ((args_0: { + hash: string; + chunk: JsChunk; + filename: string; + }, ...args_1: unknown[]) => string) | { + banner: (string | ((args_0: { + hash: string; + chunk: JsChunk; + filename: string; + }, ...args_1: unknown[]) => string)) & (string | ((args_0: { + hash: string; + chunk: JsChunk; + filename: string; + }, ...args_1: unknown[]) => string) | undefined); + entryOnly?: boolean | undefined; + exclude?: string | RegExp | (string | RegExp)[] | undefined; + include?: string | RegExp | (string | RegExp)[] | undefined; + raw?: boolean | undefined; + footer?: boolean | undefined; + test?: string | RegExp | (string | RegExp)[] | undefined; + }): { + name: BuiltinPluginName; + _options: RawBannerPluginOptions; + affectedHooks: "done" | "compilation" | "make" | "compile" | "emit" | "afterEmit" | "invalid" | "thisCompilation" | "afterDone" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "failed" | "shutdown" | "watchRun" | "watchClose" | "environment" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | undefined; + raw(): BuiltinPlugin; + apply(compiler: Compiler_2): void; + }; +}; + +// Warning: (ae-forgotten-export) The symbol "bannerPluginArgument" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type BannerPluginArgument = z.infer; + +// Warning: (ae-forgotten-export) The symbol "baseUri" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type BaseUri = z.infer; + +// Warning: (ae-forgotten-export) The symbol "builtins" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type Builtins = z.infer; + +// Warning: (ae-forgotten-export) The symbol "cacheOptions" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type CacheOptions = z.infer; + +// Warning: (ae-forgotten-export) The symbol "chunkFilename" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type ChunkFilename = z.infer; + +// Warning: (ae-forgotten-export) The symbol "chunkFormat" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type ChunkFormat = z.infer; + +// @public (undocumented) +export class ChunkGroup { + protected constructor(inner: JsChunkGroup, compilation: JsCompilation); + // (undocumented) + static __from_binding(chunk: JsChunkGroup, compilation: JsCompilation): ChunkGroup; + // (undocumented) + __internal_inner_compilation(): JsCompilation; + // (undocumented) + __internal_inner_ukey(): number; + // (undocumented) + getFiles(): string[]; + // (undocumented) + getParents(): ChunkGroup[]; + // (undocumented) + get index(): number | undefined; + // (undocumented) + get name(): string | undefined; +} + +// Warning: (ae-forgotten-export) The symbol "chunkLoading" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type ChunkLoading = z.infer; + +// Warning: (ae-forgotten-export) The symbol "chunkLoadingGlobal" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type ChunkLoadingGlobal = z.infer; + +// Warning: (ae-forgotten-export) The symbol "chunkLoadingType" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type ChunkLoadingType = z.infer; + +// Warning: (ae-forgotten-export) The symbol "clean" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type Clean = z.infer; + +// @public (undocumented) +export class Compilation { + constructor(compiler: Compiler, inner: JsCompilation); + // @internal + __internal__deleteAssetSource(filename: string): void; + // @internal + __internal__findJsModule(identifier: string, modules: Map): JsModule | undefined; + // @internal + __internal__getAssetFilenames(): string[]; + // @internal + __internal__getAssetSource(filename: string): Source | void; + // @internal + __internal__getAssociatedModules(chunk: JsStatsChunk): any[] | undefined; + // @internal + __internal__getChunks(): Chunk[]; + // @internal + __internal__getModules(): JsModule[]; + // @internal + __internal__hasAsset(name: string): boolean; + // (undocumented) + __internal__pushNativeDiagnostics(diagnostics: ExternalObject): void; + // @internal + __internal__setAssetSource(filename: string, source: Source): void; + // (undocumented) + __internal_getInner(): JsCompilation; + get assets(): Record; + // (undocumented) + buildDependencies: { + [Symbol.iterator](): Generator; + has(dep: string): boolean; + add: (dep: string) => void; + addAll: (deps: Iterable) => void; + }; + // (undocumented) + children: Compilation[]; + // (undocumented) + childrenCounters: Record; + // Warning: (ae-forgotten-export) The symbol "ChunkGraph" needs to be exported by the entry point index.d.ts + // + // (undocumented) + chunkGraph: ChunkGraph; + // (undocumented) + get chunks(): Chunk[]; + // (undocumented) + compiler: Compiler; + // (undocumented) + contextDependencies: { + [Symbol.iterator](): Generator; + has(dep: string): boolean; + add: (dep: string) => void; + addAll: (deps: Iterable) => void; + }; + // (undocumented) + createChildCompiler(name: string, outputOptions: OutputNormalized, plugins: RspackPluginInstance[]): Compiler; + // (undocumented) + createStatsFactory(options: StatsOptions): StatsFactory; + // Warning: (ae-forgotten-export) The symbol "CreateStatsOptionsContext" needs to be exported by the entry point index.d.ts + // + // (undocumented) + createStatsOptions(optionsOrPreset: StatsValue | undefined, context?: CreateStatsOptionsContext): StatsOptions; + // (undocumented) + createStatsPrinter(options: StatsOptions): StatsPrinter; + // (undocumented) + get currentNormalModuleHooks(): { + loader: tapable.SyncHook<[LoaderContext_2< {}>], void, tapable.UnsetAdditionalOptions>; + readResourceForScheme: any; + readResource: tapable.HookMap], string | Buffer, tapable.UnsetAdditionalOptions>>; + }; + // (undocumented) + deleteAsset(filename: string): void; + emitAsset(filename: string, source: Source, assetInfo?: AssetInfo): void; + // (undocumented) + endTime?: number; + // Warning: (ae-forgotten-export) The symbol "Entrypoint" needs to be exported by the entry point index.d.ts + get entrypoints(): ReadonlyMap; + // (undocumented) + get errors(): { + push: (...errs: (Error | JsStatsError | string)[]) => void; + readonly length: number; + [Symbol.iterator](): { + next(): { + done: boolean; + value?: undefined; + } | { + value: JsStatsError; + done: boolean; + }; + }; + }; + // (undocumented) + fileDependencies: { + [Symbol.iterator](): Generator; + has(dep: string): boolean; + add: (dep: string) => void; + addAll: (deps: Iterable) => void; + }; + // (undocumented) + fileSystemInfo: { + createSnapshot(): null; + }; + // (undocumented) + get fullHash(): string | null; + // (undocumented) + getAsset(name: string): Asset | void; + // (undocumented) + getAssetPath(filename: Filename, data?: PathData): string; + // (undocumented) + getAssetPathWithInfo(filename: Filename, data?: PathData): PathWithInfo; + getAssets(): Readonly[]; + // (undocumented) + getCache(name: string): libCacheFacade; + // Warning: (ae-forgotten-export) The symbol "Logger" needs to be exported by the entry point index.d.ts + // + // (undocumented) + getLogger(name: string | (() => string)): Logger; + // (undocumented) + getPath(filename: Filename, data?: PathData): string; + // (undocumented) + getPathWithInfo(filename: Filename, data?: PathData): PathWithInfo; + // (undocumented) + getStats(): Stats; + // (undocumented) + get hash(): string | null; + // (undocumented) + hooks: { + processAssets: liteTapable.AsyncSeriesHook; + afterProcessAssets: liteTapable.SyncHook; + childCompiler: tapable.SyncHook<[Compiler, string, number]>; + log: tapable.SyncBailHook<[string, LogEntry], true>; + additionalAssets: any; + optimizeModules: liteTapable.SyncBailHook, void>; + afterOptimizeModules: liteTapable.SyncHook, void>; + optimizeTree: liteTapable.AsyncSeriesHook<[ + Iterable, + Iterable + ]>; + optimizeChunkModules: liteTapable.AsyncSeriesBailHook<[ + Iterable, + Iterable + ], void>; + finishModules: liteTapable.AsyncSeriesHook<[Iterable], void>; + chunkAsset: liteTapable.SyncHook<[Chunk, string], void>; + processWarnings: tapable.SyncWaterfallHook<[Error[]]>; + succeedModule: liteTapable.SyncHook<[Module], void>; + stillValidModule: liteTapable.SyncHook<[Module], void>; + statsFactory: tapable.SyncHook<[StatsFactory, StatsOptions], void>; + statsPrinter: tapable.SyncHook<[StatsPrinter, StatsOptions], void>; + buildModule: liteTapable.SyncHook<[Module]>; + executeModule: liteTapable.SyncHook<[ + ExecuteModuleArgument, + ExecuteModuleContext + ]>; + runtimeModule: liteTapable.SyncHook<[JsRuntimeModule, Chunk], void>; + afterSeal: liteTapable.AsyncSeriesHook<[], void>; + }; + // (undocumented) + inputFileSystem: any; + // (undocumented) + logging: Map; + // (undocumented) + missingDependencies: { + [Symbol.iterator](): Generator; + has(dep: string): boolean; + add: (dep: string) => void; + addAll: (deps: Iterable) => void; + }; + // (undocumented) + get modules(): Module[]; + // (undocumented) + name?: string; + get namedChunks(): Map>; + // (undocumented) + options: RspackOptionsNormalized; + // (undocumented) + outputOptions: OutputNormalized; + // (undocumented) + static PROCESS_ASSETS_STAGE_ADDITIONAL: number; + // (undocumented) + static PROCESS_ASSETS_STAGE_ADDITIONS: number; + // (undocumented) + static PROCESS_ASSETS_STAGE_ANALYSE: number; + // (undocumented) + static PROCESS_ASSETS_STAGE_DERIVED: number; + // (undocumented) + static PROCESS_ASSETS_STAGE_DEV_TOOLING: number; + // (undocumented) + static PROCESS_ASSETS_STAGE_NONE: number; + // (undocumented) + static PROCESS_ASSETS_STAGE_OPTIMIZE: number; + // (undocumented) + static PROCESS_ASSETS_STAGE_OPTIMIZE_COMPATIBILITY: number; + // (undocumented) + static PROCESS_ASSETS_STAGE_OPTIMIZE_COUNT: number; + // (undocumented) + static PROCESS_ASSETS_STAGE_OPTIMIZE_HASH: number; + // (undocumented) + static PROCESS_ASSETS_STAGE_OPTIMIZE_INLINE: number; + // (undocumented) + static PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE: number; + // (undocumented) + static PROCESS_ASSETS_STAGE_OPTIMIZE_TRANSFER: number; + // (undocumented) + static PROCESS_ASSETS_STAGE_PRE_PROCESS: number; + // (undocumented) + static PROCESS_ASSETS_STAGE_REPORT: number; + // (undocumented) + static PROCESS_ASSETS_STAGE_SUMMARIZE: number; + // (undocumented) + pushDiagnostic(severity: "error" | "warning", title: string, message: string): void; + // (undocumented) + rebuildModule(m: Module, f: (err: Error, m: Module) => void): void; + // Warning: (ae-forgotten-export) The symbol "MergeCaller" needs to be exported by the entry point index.d.ts + // + // (undocumented) + _rebuildModuleCaller: MergeCaller<[string, (err: Error, m: Module) => void]>; + // (undocumented) + renameAsset(filename: string, newFilename: string): void; + // (undocumented) + resolverFactory: ResolverFactory; + // (undocumented) + seal(): void; + // (undocumented) + startTime?: number; + // (undocumented) + unseal(): void; + updateAsset(filename: string, newSourceOrFunction: Source | ((source: Source) => Source), assetInfoUpdateOrFunction?: AssetInfo | ((assetInfo: AssetInfo) => AssetInfo)): void; + // (undocumented) + get warnings(): { + push: (...warns: (Error | JsStatsError)[]) => void; + [Symbol.iterator](): { + next(): { + done: boolean; + value?: undefined; + } | { + value: JsStatsWarning[]; + done: boolean; + }; + }; + }; +} + +// @public (undocumented) +export interface CompilationParams { + // Warning: (ae-forgotten-export) The symbol "ContextModuleFactory" needs to be exported by the entry point index.d.ts + // + // (undocumented) + contextModuleFactory: ContextModuleFactory; + // (undocumented) + normalModuleFactory: NormalModuleFactory; +} + +// @public (undocumented) +export class Compiler { + constructor(context: string, options: RspackOptionsNormalized); + // (undocumented) + __internal__getModuleExecutionResult(id: number): any; + // @internal + __internal__rebuild(modifiedFiles?: ReadonlySet, removedFiles?: ReadonlySet, callback?: (error: Error | null) => void): void; + // (undocumented) + __internal__registerBuiltinPlugin(plugin: binding.BuiltinPlugin): void; + // (undocumented) + builtinPlugins: binding.BuiltinPlugin[]; + // (undocumented) + cache: Cache_2; + // (undocumented) + close(callback: (error?: Error | null) => void): void; + // (undocumented) + compilation?: Compilation; + // (undocumented) + compilationParams?: CompilationParams; + // (undocumented) + compile(callback: Callback_2): void; + // (undocumented) + compilerPath: string; + // (undocumented) + context: string; + // (undocumented) + contextTimestamps?: ReadonlyMap; + // (undocumented) + createChildCompiler(compilation: Compilation, compilerName: string, compilerIndex: number, outputOptions: OutputNormalized, plugins: RspackPluginInstance[]): Compiler; + // Warning: (ae-forgotten-export) The symbol "FileSystemInfoEntry_2" needs to be exported by the entry point index.d.ts + // + // (undocumented) + fileTimestamps?: ReadonlyMap; + // (undocumented) + getAsset(name: string): Buffer | null; + // (undocumented) + getCache(name: string): CacheFacade; + // (undocumented) + getInfrastructureLogger(name: string | Function): Logger; + // (undocumented) + hooks: { + done: tapable.AsyncSeriesHook; + afterDone: tapable.SyncHook; + thisCompilation: liteTapable.SyncHook<[Compilation, CompilationParams]>; + compilation: liteTapable.SyncHook<[Compilation, CompilationParams]>; + invalid: tapable.SyncHook<[string | null, number]>; + compile: tapable.SyncHook<[CompilationParams]>; + normalModuleFactory: tapable.SyncHook; + contextModuleFactory: tapable.SyncHook; + initialize: tapable.SyncHook<[]>; + shouldEmit: liteTapable.SyncBailHook<[Compilation], boolean>; + infrastructureLog: tapable.SyncBailHook<[string, string, any[]], true>; + beforeRun: tapable.AsyncSeriesHook<[Compiler]>; + run: tapable.AsyncSeriesHook<[Compiler]>; + emit: liteTapable.AsyncSeriesHook<[Compilation]>; + assetEmitted: liteTapable.AsyncSeriesHook<[string, AssetEmittedInfo]>; + afterEmit: liteTapable.AsyncSeriesHook<[Compilation]>; + failed: tapable.SyncHook<[Error]>; + shutdown: tapable.AsyncSeriesHook<[]>; + watchRun: tapable.AsyncSeriesHook<[Compiler]>; + watchClose: tapable.SyncHook<[]>; + environment: tapable.SyncHook<[]>; + afterEnvironment: tapable.SyncHook<[]>; + afterPlugins: tapable.SyncHook<[Compiler]>; + afterResolvers: tapable.SyncHook<[Compiler]>; + make: liteTapable.AsyncParallelHook<[Compilation]>; + beforeCompile: tapable.AsyncSeriesHook<[CompilationParams]>; + afterCompile: tapable.AsyncSeriesHook<[Compilation]>; + finishMake: liteTapable.AsyncSeriesHook<[Compilation]>; + entryOption: tapable.SyncBailHook<[string, EntryNormalized], any>; + }; + // (undocumented) + idle: boolean; + // (undocumented) + infrastructureLogger: any; + // (undocumented) + inputFileSystem: any; + // (undocumented) + intermediateFileSystem: any; + // (undocumented) + isChild(): boolean; + // (undocumented) + modifiedFiles?: ReadonlySet; + // (undocumented) + name?: string; + // (undocumented) + options: RspackOptionsNormalized; + // (undocumented) + outputFileSystem: fs; + // (undocumented) + outputPath: string; + // (undocumented) + parentCompilation?: Compilation; + // (undocumented) + purgeInputFileSystem(): void; + // (undocumented) + removedFiles?: ReadonlySet; + // (undocumented) + resolverFactory: ResolverFactory; + // (undocumented) + root: Compiler; + // Warning: (ae-forgotten-export) The symbol "RuleSetCompiler" needs to be exported by the entry point index.d.ts + // + // (undocumented) + ruleSet: RuleSetCompiler; + // (undocumented) + run(callback: Callback_2): void; + // (undocumented) + runAsChild(callback: any): void; + // (undocumented) + running: boolean; + // (undocumented) + watch(watchOptions: WatchOptions_2, handler: Callback_2): Watching; + // Warning: (ae-forgotten-export) The symbol "WatchFileSystem" needs to be exported by the entry point index.d.ts + // + // (undocumented) + watchFileSystem: WatchFileSystem; + // (undocumented) + watching?: Watching; + // (undocumented) + watchMode: boolean; + // (undocumented) + webpack: rspack_3 & exports_2 & { + rspack: rspack_3 & exports_2 & any; + webpack: rspack_3 & exports_2 & any; + }; +} + +// Warning: (ae-forgotten-export) The symbol "Config" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export const config: Config; + +// @public (undocumented) +export type Configuration = RspackOptions; + +// @public (undocumented) +export type Consumes = (ConsumesItem | ConsumesObject)[] | ConsumesObject; + +// @public (undocumented) +export type ConsumesConfig = { + eager?: boolean; + import?: false | ConsumesItem; + packageName?: string; + requiredVersion?: false | string; + shareKey?: string; + shareScope?: string; + singleton?: boolean; + strictVersion?: boolean; +}; + +// @public (undocumented) +export type ConsumeSharedPluginOptions = { + consumes: Consumes; + shareScope?: string; + enhanced?: boolean; +}; + +// @public (undocumented) +export type ConsumesItem = string; + +// @public (undocumented) +export type ConsumesObject = { + [k: string]: ConsumesConfig | ConsumesItem; +}; + +// @public (undocumented) +export const container: { + ContainerPlugin: typeof ContainerPlugin; + ContainerReferencePlugin: typeof ContainerReferencePlugin; + ModuleFederationPlugin: typeof ModuleFederationPlugin; + ModuleFederationPluginV1: typeof ModuleFederationPluginV1; +}; + +// @public (undocumented) +export type ContainerPluginOptions = { + exposes: Exposes; + filename?: FilenameTemplate; + library?: LibraryOptions; + name: string; + runtime?: EntryRuntime; + shareScope?: string; + enhanced?: boolean; +}; + +// @public (undocumented) +export type ContainerReferencePluginOptions = { + remoteType: ExternalsType; + remotes: Remotes; + shareScope?: string; + enhanced?: boolean; +}; + +// Warning: (ae-forgotten-export) The symbol "context" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type Context = z.infer; + +// @public (undocumented) +export const CopyRspackPlugin: { + new (copy: CopyRspackPluginOptions): { + name: BuiltinPluginName; + _options: RawCopyRspackPluginOptions; + affectedHooks: "done" | "compilation" | "make" | "compile" | "emit" | "afterEmit" | "invalid" | "thisCompilation" | "afterDone" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "failed" | "shutdown" | "watchRun" | "watchClose" | "environment" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | undefined; + raw(): BuiltinPlugin; + apply(compiler: Compiler_2): void; + }; +}; + +// @public (undocumented) +export type CopyRspackPluginOptions = { + patterns: (string | ({ + from: string; + } & Partial))[]; +}; + +// Warning: (ae-forgotten-export) The symbol "crossOriginLoading" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type CrossOriginLoading = z.infer; + +// Warning: (ae-forgotten-export) The symbol "cssAutoGeneratorOptions" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type CssAutoGeneratorOptions = z.infer; + +// Warning: (ae-forgotten-export) The symbol "cssAutoParserOptions" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type CssAutoParserOptions = z.infer; + +// Warning: (ae-forgotten-export) The symbol "cssChunkFilename" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type CssChunkFilename = z.infer; + +// @public (undocumented) +export class CssExtractRspackPlugin { + constructor(options?: PluginOptions); + // (undocumented) + apply(compiler: Compiler): void; + // (undocumented) + static loader: string; + // (undocumented) + normalizeOptions(options: PluginOptions): RawCssExtractPluginOption; + // Warning: (ae-forgotten-export) The symbol "PluginOptions" needs to be exported by the entry point index.d.ts + // + // (undocumented) + options: PluginOptions; + // (undocumented) + static pluginName: string; +} + +// Warning: (ae-forgotten-export) The symbol "cssFilename" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type CssFilename = z.infer; + +// Warning: (ae-forgotten-export) The symbol "cssGeneratorExportsConvention" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type CssGeneratorExportsConvention = z.infer; + +// Warning: (ae-forgotten-export) The symbol "cssGeneratorExportsOnly" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type CssGeneratorExportsOnly = z.infer; + +// Warning: (ae-forgotten-export) The symbol "cssGeneratorLocalIdentName" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type CssGeneratorLocalIdentName = z.infer; + +// Warning: (ae-forgotten-export) The symbol "cssGeneratorOptions" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type CssGeneratorOptions = z.infer; + +// Warning: (ae-forgotten-export) The symbol "cssModuleGeneratorOptions" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type CssModuleGeneratorOptions = z.infer; + +// Warning: (ae-forgotten-export) The symbol "cssModuleParserOptions" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type CssModuleParserOptions = z.infer; + +// Warning: (ae-forgotten-export) The symbol "cssParserNamedExports" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type CssParserNamedExports = z.infer; + +// Warning: (ae-forgotten-export) The symbol "cssParserOptions" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type CssParserOptions = z.infer; + +// @public (undocumented) +export const DefinePlugin: { + new (define: DefinePluginOptions): { + name: BuiltinPluginName; + _options: Record; + affectedHooks: "done" | "compilation" | "make" | "compile" | "emit" | "afterEmit" | "invalid" | "thisCompilation" | "afterDone" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "failed" | "shutdown" | "watchRun" | "watchClose" | "environment" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | undefined; + raw(): BuiltinPlugin; + apply(compiler: Compiler_2): void; + }; +}; + +// @public (undocumented) +export type DefinePluginOptions = Record; + +// Warning: (ae-forgotten-export) The symbol "dependencies" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type Dependencies = z.infer; + +// @public (undocumented) +export interface DevServer extends webpackDevServer.Configuration { +} + +// Warning: (ae-forgotten-export) The symbol "devTool" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type DevTool = z.infer; + +// Warning: (ae-forgotten-export) The symbol "devtoolFallbackModuleFilenameTemplate" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type DevtoolFallbackModuleFilenameTemplate = z.infer; + +// Warning: (ae-forgotten-export) The symbol "devtoolModuleFilenameTemplate" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type DevtoolModuleFilenameTemplate = z.infer; + +// Warning: (ae-forgotten-export) The symbol "devtoolNamespace" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type DevtoolNamespace = z.infer; + +// Warning: (ae-forgotten-export) The symbol "Electron" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export const electron: Electron; + +// Warning: (ae-forgotten-export) The symbol "enabledChunkLoadingTypes" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type EnabledChunkLoadingTypes = z.infer; + +// Warning: (ae-forgotten-export) The symbol "enabledLibraryTypes" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type EnabledLibraryTypes = z.infer; + +// Warning: (ae-forgotten-export) The symbol "enabledWasmLoadingTypes" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type EnabledWasmLoadingTypes = z.infer; + +// Warning: (ae-forgotten-export) The symbol "entry" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type Entry = z.infer; + +// Warning: (ae-forgotten-export) The symbol "entryDependOn" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type EntryDependOn = z.infer; + +// Warning: (ae-forgotten-export) The symbol "entryDescription" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type EntryDescription = z.infer; + +// @public (undocumented) +export interface EntryDescriptionNormalized { + // (undocumented) + asyncChunks?: boolean; + // (undocumented) + baseUri?: string; + // (undocumented) + chunkLoading?: ChunkLoading; + // (undocumented) + dependOn?: string[]; + // (undocumented) + filename?: EntryFilename; + // (undocumented) + import?: string[]; + // (undocumented) + library?: LibraryOptions; + // (undocumented) + publicPath?: PublicPath; + // (undocumented) + runtime?: EntryRuntime; +} + +// Warning: (ae-forgotten-export) The symbol "entryFilename" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type EntryFilename = z.infer; + +// Warning: (ae-forgotten-export) The symbol "entryItem" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type EntryItem = z.infer; + +// @public (undocumented) +export type EntryNormalized = EntryStaticNormalized; + +// Warning: (ae-forgotten-export) The symbol "entryObject" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type EntryObject = z.infer; + +// @public (undocumented) +export class EntryOptionPlugin { + // (undocumented) + apply(compiler: Compiler): void; + // (undocumented) + static applyEntryOption(compiler: Compiler, context: string, entry: EntryNormalized): void; + // (undocumented) + static entryDescriptionToOptions(compiler: Compiler, name: string, desc: EntryDescriptionNormalized): EntryOptions; +} + +// @public (undocumented) +export type EntryOptions = { + name?: string; + runtime?: EntryRuntime; + chunkLoading?: ChunkLoading; + asyncChunks?: boolean; + publicPath?: PublicPath; + baseUri?: string; + filename?: FilenameTemplate; + library?: LibraryOptions; + dependOn?: string[]; +}; + +// @public (undocumented) +export const EntryPlugin: { + new (context: string, entry: string, options?: string | EntryOptions | undefined): { + name: BuiltinPluginName; + _options: RawEntryPluginOptions; + affectedHooks: "done" | "compilation" | "make" | "compile" | "emit" | "afterEmit" | "invalid" | "thisCompilation" | "afterDone" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "failed" | "shutdown" | "watchRun" | "watchClose" | "environment" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | undefined; + raw(): BuiltinPlugin; + apply(compiler: Compiler_2): void; + }; +}; + +// Warning: (ae-forgotten-export) The symbol "entryRuntime" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type EntryRuntime = z.infer; + +// Warning: (ae-forgotten-export) The symbol "entryStatic" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type EntryStatic = z.infer; + +// @public (undocumented) +export interface EntryStaticNormalized { + // (undocumented) + [k: string]: EntryDescriptionNormalized; +} + +// Warning: (ae-forgotten-export) The symbol "entryUnnamed" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type EntryUnnamed = z.infer; + +// @public +export class EnvironmentPlugin { + constructor(...keys: any[]); + // Warning: (ae-forgotten-export) The symbol "Compiler_5" needs to be exported by the entry point index.d.ts + apply(compiler: Compiler_5): void; + // (undocumented) + defaultValues: any; + // (undocumented) + keys: any[]; +} + +// @public (undocumented) +export const EvalDevToolModulePlugin: { + new (options: EvalDevToolModulePluginOptions): { + name: BuiltinPluginName; + _options: EvalDevToolModulePluginOptions; + affectedHooks: "done" | "compilation" | "make" | "compile" | "emit" | "afterEmit" | "invalid" | "thisCompilation" | "afterDone" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "failed" | "shutdown" | "watchRun" | "watchClose" | "environment" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | undefined; + raw(): BuiltinPlugin; + apply(compiler: Compiler_2): void; + }; +}; + +export { EvalDevToolModulePluginOptions } + +// @public (undocumented) +export const EvalSourceMapDevToolPlugin: { + new (options: SourceMapDevToolPluginOptions): { + name: BuiltinPluginName; + _options: RawSourceMapDevToolPluginOptions; + affectedHooks: "done" | "compilation" | "make" | "compile" | "emit" | "afterEmit" | "invalid" | "thisCompilation" | "afterDone" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "failed" | "shutdown" | "watchRun" | "watchClose" | "environment" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | undefined; + raw(): BuiltinPlugin; + apply(compiler: Compiler_2): void; + }; +}; + +export { experimental_cleanupGlobalTrace } + +export { experimental_registerGlobalTrace } + +// Warning: (ae-forgotten-export) The symbol "experiments" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type Experiments = z.infer; + +// @public (undocumented) +export interface ExperimentsNormalized { + // (undocumented) + asyncWebAssembly?: boolean; + // (undocumented) + css?: boolean; + // (undocumented) + futureDefaults?: boolean; + // (undocumented) + lazyCompilation?: boolean; + // (undocumented) + newSplitChunks?: boolean; + // (undocumented) + outputModule?: boolean; + // (undocumented) + rspackFuture?: RspackFutureOptions; + // (undocumented) + topLevelAwait?: boolean; +} + +// @public (undocumented) +export type Exposes = (ExposesItem | ExposesObject)[] | ExposesObject; + +// @public (undocumented) +export type ExposesConfig = { + import: ExposesItem | ExposesItems; + name?: string; +}; + +// @public (undocumented) +export type ExposesItem = string; + +// @public (undocumented) +export type ExposesItems = ExposesItem[]; + +// @public (undocumented) +export type ExposesObject = { + [k: string]: ExposesConfig | ExposesItem | ExposesItems; +}; + +// Warning: (ae-forgotten-export) The symbol "externalItem" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type ExternalItem = z.infer; + +// Warning: (ae-forgotten-export) The symbol "externalItemFunctionData" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type ExternalItemFunctionData = z.infer; + +// Warning: (ae-forgotten-export) The symbol "externalItemObjectUnknown" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type ExternalItemObjectUnknown = z.infer; + +// Warning: (ae-forgotten-export) The symbol "externalItemValue" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type ExternalItemValue = z.infer; + +// Warning: (ae-forgotten-export) The symbol "externals" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type Externals = z.infer; + +// @public (undocumented) +export const ExternalsPlugin: { + new (type: string, externals: string | RegExp | Record> | ((args_0: { + context?: string | undefined; + dependencyType?: string | undefined; + request?: string | undefined; + }, args_1: (args_0: Error | undefined, args_1: string | boolean | string[] | Record | undefined, args_2: "promise" | "jsonp" | "import" | "amd" | "commonjs" | "commonjs2" | "var" | "module" | "assign" | "this" | "window" | "self" | "global" | "commonjs-module" | "commonjs-static" | "amd-require" | "umd" | "umd2" | "system" | "script" | "node-commonjs" | undefined, ...args_3: unknown[]) => void, ...args_2: unknown[]) => unknown) | ((args_0: { + context?: string | undefined; + dependencyType?: string | undefined; + request?: string | undefined; + }, ...args_1: unknown[]) => Promise>) | (string | RegExp | Record> | ((args_0: { + context?: string | undefined; + dependencyType?: string | undefined; + request?: string | undefined; + }, args_1: (args_0: Error | undefined, args_1: string | boolean | string[] | Record | undefined, args_2: "promise" | "jsonp" | "import" | "amd" | "commonjs" | "commonjs2" | "var" | "module" | "assign" | "this" | "window" | "self" | "global" | "commonjs-module" | "commonjs-static" | "amd-require" | "umd" | "umd2" | "system" | "script" | "node-commonjs" | undefined, ...args_3: unknown[]) => void, ...args_2: unknown[]) => unknown) | ((args_0: { + context?: string | undefined; + dependencyType?: string | undefined; + request?: string | undefined; + }, ...args_1: unknown[]) => Promise>))[]): { + name: BuiltinPluginName; + _options: RawExternalsPluginOptions; + affectedHooks: "done" | "compilation" | "make" | "compile" | "emit" | "afterEmit" | "invalid" | "thisCompilation" | "afterDone" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "failed" | "shutdown" | "watchRun" | "watchClose" | "environment" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | undefined; + raw(): BuiltinPlugin; + apply(compiler: Compiler_2): void; + }; +}; + +// Warning: (ae-forgotten-export) The symbol "externalsPresets" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type ExternalsPresets = z.infer; + +// @public (undocumented) +export type ExternalsType = z.infer; + +// @public (undocumented) +export const externalsType: z.ZodEnum<["var", "module", "assign", "this", "window", "self", "global", "commonjs", "commonjs2", "commonjs-module", "commonjs-static", "amd", "amd-require", "umd", "umd2", "jsonp", "system", "promise", "import", "script", "node-commonjs"]>; + +// Warning: (ae-forgotten-export) The symbol "falsy" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type Falsy = z.infer; + +// Warning: (ae-forgotten-export) The symbol "filename" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type Filename = z.infer; + +// Warning: (ae-forgotten-export) The symbol "filenameTemplate" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type FilenameTemplate = z.infer; + +// Warning: (ae-forgotten-export) The symbol "filterItemTypes" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type FilterItemTypes = z.infer; + +// Warning: (ae-forgotten-export) The symbol "filterTypes" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type FilterTypes = z.infer; + +// Warning: (ae-forgotten-export) The symbol "generatorOptionsByModuleType" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type GeneratorOptionsByModuleType = z.infer; + +// Warning: (ae-forgotten-export) The symbol "generatorOptionsByModuleTypeKnown" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type GeneratorOptionsByModuleTypeKnown = z.infer; + +// Warning: (ae-forgotten-export) The symbol "generatorOptionsByModuleTypeUnknown" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type GeneratorOptionsByModuleTypeUnknown = z.infer; + +// @public (undocumented) +export const getNormalizedRspackOptions: (config: RspackOptions) => RspackOptionsNormalized; + +// @public (undocumented) +export function getRawChunkLoading(chunkLoading: ChunkLoading): string; + +// @public (undocumented) +export function getRawEntryRuntime(runtime: EntryRuntime): string | undefined; + +// @public (undocumented) +export function getRawLibrary(library: LibraryOptions): RawLibraryOptions; + +// @public (undocumented) +export const getRawOptions: (options: RspackOptionsNormalized, compiler: Compiler) => RawOptions; + +// Warning: (ae-forgotten-export) The symbol "globalObject" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type GlobalObject = z.infer; + +// Warning: (ae-forgotten-export) The symbol "hashDigest" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type HashDigest = z.infer; + +// Warning: (ae-forgotten-export) The symbol "hashDigestLength" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type HashDigestLength = z.infer; + +// Warning: (ae-forgotten-export) The symbol "hashFunction" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type HashFunction = z.infer; + +// Warning: (ae-forgotten-export) The symbol "hashSalt" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type HashSalt = z.infer; + +// Warning: (ae-forgotten-export) The symbol "RspackBuiltinPlugin" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export class HotModuleReplacementPlugin extends RspackBuiltinPlugin { + // (undocumented) + name: BuiltinPluginName; + // (undocumented) + raw(compiler: Compiler): BuiltinPlugin; +} + +// Warning: (ae-forgotten-export) The symbol "hotUpdateChunkFilename" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type HotUpdateChunkFilename = z.infer; + +// Warning: (ae-forgotten-export) The symbol "hotUpdateGlobal" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type HotUpdateGlobal = z.infer; + +// Warning: (ae-forgotten-export) The symbol "hotUpdateMainFilename" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type HotUpdateMainFilename = z.infer; + +// @public (undocumented) +export const HtmlRspackPlugin: { + new (c?: { + filename?: string | undefined; + template?: string | undefined; + templateContent?: string | undefined; + templateParameters?: Record | undefined; + inject?: boolean | "head" | "body" | undefined; + publicPath?: string | undefined; + scriptLoading?: "module" | "blocking" | "defer" | undefined; + chunks?: string[] | undefined; + excludedChunks?: string[] | undefined; + sri?: "sha256" | "sha384" | "sha512" | undefined; + minify?: boolean | undefined; + title?: string | undefined; + favicon?: string | undefined; + meta?: Record> | undefined; + } | undefined): { + name: BuiltinPluginName; + _options: RawHtmlRspackPluginOptions; + affectedHooks: "done" | "compilation" | "make" | "compile" | "emit" | "afterEmit" | "invalid" | "thisCompilation" | "afterDone" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "failed" | "shutdown" | "watchRun" | "watchClose" | "environment" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | undefined; + raw(): BuiltinPlugin; + apply(compiler: Compiler_2): void; + }; +}; + +// Warning: (ae-forgotten-export) The symbol "htmlRspackPluginOptions" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type HtmlRspackPluginOptions = z.infer; + +// @public (undocumented) +export const IgnorePlugin: { + new (options: RawIgnorePluginOptions): { + name: BuiltinPluginName; + _options: RawIgnorePluginOptions; + affectedHooks: "done" | "compilation" | "make" | "compile" | "emit" | "afterEmit" | "invalid" | "thisCompilation" | "afterDone" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "failed" | "shutdown" | "watchRun" | "watchClose" | "environment" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | undefined; + raw(): BuiltinPlugin; + apply(compiler: Compiler_2): void; + }; +}; + +// @public (undocumented) +export type IgnorePluginOptions = RawIgnorePluginOptions; + +// Warning: (ae-forgotten-export) The symbol "ignoreWarnings" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type IgnoreWarnings = z.infer; + +// @public (undocumented) +export type IgnoreWarningsNormalized = ((warning: Error, compilation: Compilation) => boolean)[]; + +// Warning: (ae-forgotten-export) The symbol "iife" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type Iife = z.infer; + +// Warning: (ae-forgotten-export) The symbol "importFunctionName" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type ImportFunctionName = z.infer; + +// Warning: (ae-forgotten-export) The symbol "infrastructureLogging" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type InfrastructureLogging = z.infer; + +// Warning: (ae-forgotten-export) The symbol "JavaScript" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export const javascript: JavaScript; + +// Warning: (ae-forgotten-export) The symbol "javascriptParserOptions" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type JavascriptParserOptions = z.infer; + +// Warning: (ae-forgotten-export) The symbol "library_2" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type Library = z.infer; + +// Warning: (ae-forgotten-export) The symbol "Library_2" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export const library: Library_2; + +// Warning: (ae-forgotten-export) The symbol "libraryCustomUmdCommentObject" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type LibraryCustomUmdCommentObject = z.infer; + +// Warning: (ae-forgotten-export) The symbol "libraryCustomUmdObject" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type LibraryCustomUmdObject = z.infer; + +// Warning: (ae-forgotten-export) The symbol "libraryExport" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type LibraryExport = z.infer; + +// Warning: (ae-forgotten-export) The symbol "libraryName" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type LibraryName = z.infer; + +// Warning: (ae-forgotten-export) The symbol "libraryOptions" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type LibraryOptions = z.infer; + +// Warning: (ae-forgotten-export) The symbol "libraryType" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type LibraryType = z.infer; + +// @public (undocumented) +export interface LoaderContext { + // @internal + __internal__context: JsLoaderContext; + // @internal + __internal__pushNativeDiagnostics: (diagnostics: any) => void; + // (undocumented) + addBuildDependency(file: string): void; + // (undocumented) + addContextDependency(context: string): void; + // (undocumented) + addDependency(file: string): void; + // (undocumented) + addMissingDependency(missing: string): void; + // Warning: (ae-forgotten-export) The symbol "SourceMap" needs to be exported by the entry point index.d.ts + // Warning: (ae-forgotten-export) The symbol "AdditionalData" needs to be exported by the entry point index.d.ts + // + // (undocumented) + async(): (err?: Error | null, content?: string | Buffer, sourceMap?: string | SourceMap, additionalData?: AdditionalData) => void; + // (undocumented) + cacheable(cacheable?: boolean): void; + // (undocumented) + callback(err?: Error | null, content?: string | Buffer, sourceMap?: string | SourceMap, additionalData?: AdditionalData): void; + // (undocumented) + clearDependencies(): void; + // (undocumented) + _compilation: Compiler["compilation"]; + // (undocumented) + _compiler: Compiler; + // (undocumented) + context: string | null; + // (undocumented) + currentRequest: string; + // (undocumented) + data: unknown; + // (undocumented) + dependency(file: string): void; + // (undocumented) + emitError(error: Error): void; + // (undocumented) + emitFile(name: string, content: string | Buffer, sourceMap?: string, assetInfo?: JsAssetInfo): void; + // (undocumented) + emitWarning(warning: Error): void; + // (undocumented) + fs: any; + // (undocumented) + getContextDependencies(): string[]; + // (undocumented) + getDependencies(): string[]; + // (undocumented) + getLogger(name: string): Logger; + // (undocumented) + getMissingDependencies(): string[]; + // (undocumented) + getOptions(schema?: any): OptionsType; + // (undocumented) + getResolve(options: Resolve): (context: any, request: any, callback: any) => Promise; + // (undocumented) + hot?: boolean; + // (undocumented) + importModule(request: string, options: { + publicPath?: string; + baseUri?: string; + }, callback: (err?: Error, res?: any) => void): void; + // (undocumented) + loaderIndex: number; + // Warning: (ae-forgotten-export) The symbol "LoaderObject" needs to be exported by the entry point index.d.ts + loaders: LoaderObject[]; + // (undocumented) + mode?: Mode; + // (undocumented) + previousRequest: string; + // (undocumented) + query: string | OptionsType; + // (undocumented) + remainingRequest: string; + // (undocumented) + request: string; + // (undocumented) + resolve(context: string, request: string, callback: (arg0: null | Error, arg1?: string | false, arg2?: ResolveRequest) => void): void; + // (undocumented) + resource: string; + // (undocumented) + resourceFragment: string; + // (undocumented) + resourcePath: string; + // (undocumented) + resourceQuery: string; + // (undocumented) + rootContext: string; + // (undocumented) + sourceMap: boolean; + // (undocumented) + utils: { + absolutify: (context: string, request: string) => string; + contextify: (context: string, request: string) => string; + createHash: (algorithm?: string) => Hash; + }; + // (undocumented) + version: 2; +} + +// @public (undocumented) +export type LoaderDefinition = LoaderDefinitionFunction & { + raw?: false; + pitch?: PitchLoaderDefinitionFunction; +}; + +// @public (undocumented) +export interface LoaderDefinitionFunction { + // (undocumented) + (this: LoaderContext & ContextAdditions, content: string, sourceMap?: string | SourceMap, additionalData?: AdditionalData): string | void | Buffer | Promise; +} + +// @public +export class LoaderOptionsPlugin { + // Warning: (ae-forgotten-export) The symbol "LoaderOptionsPluginOptions" needs to be exported by the entry point index.d.ts + constructor(options?: LoaderOptionsPluginOptions); + // Warning: (ae-forgotten-export) The symbol "Compiler_3" needs to be exported by the entry point index.d.ts + apply(compiler: Compiler_3): void; + // (undocumented) + options: any; +} + +// @public +export class LoaderTargetPlugin { + constructor(target: string); + // Warning: (ae-forgotten-export) The symbol "Compiler_4" needs to be exported by the entry point index.d.ts + apply(compiler: Compiler_4): void; + // (undocumented) + target: string; +} + +// @public (undocumented) +export interface LogEntry { + // (undocumented) + args: any[]; + // (undocumented) + time?: number; + // (undocumented) + trace?: string[]; + // (undocumented) + type: string; +} + +// Warning: (ae-forgotten-export) The symbol "mode" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type Mode = z.infer; + +// @public (undocumented) +export interface ModuleFederationPluginOptions extends Omit { + // (undocumented) + implementation?: string; + // Warning: (ae-forgotten-export) The symbol "RuntimePlugins" needs to be exported by the entry point index.d.ts + // + // (undocumented) + runtimePlugins?: RuntimePlugins; +} + +// @public (undocumented) +export interface ModuleFederationPluginV1Options { + // (undocumented) + enhanced?: boolean; + // (undocumented) + exposes?: Exposes; + // (undocumented) + filename?: string; + // (undocumented) + library?: LibraryOptions; + // (undocumented) + name: string; + // (undocumented) + remotes?: Remotes; + // (undocumented) + remoteType?: ExternalsType; + // (undocumented) + runtime?: EntryRuntime; + // (undocumented) + shared?: Shared; + // (undocumented) + shareScope?: string; +} + +// @public (undocumented) +export const ModuleFilenameHelpers: any; + +// Warning: (ae-forgotten-export) The symbol "moduleOptions" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type ModuleOptions = z.infer; + +// @public (undocumented) +export interface ModuleOptionsNormalized { + // (undocumented) + defaultRules?: RuleSetRules; + // (undocumented) + generator: GeneratorOptionsByModuleType; + // (undocumented) + noParse?: NoParseOption; + // (undocumented) + parser: ParserOptionsByModuleType; + // (undocumented) + rules: RuleSetRules; +} + +// @public (undocumented) +export class MultiCompiler { + constructor(compilers: Compiler[] | Record, options?: MultiCompilerOptions); + // (undocumented) + close(callback: Callback_2): void; + // (undocumented) + compilers: Compiler[]; + // (undocumented) + context: string; + // (undocumented) + dependencies: WeakMap; + // (undocumented) + getInfrastructureLogger(name: string): Logger_2; + // (undocumented) + hooks: { + done: SyncHook_2; + invalid: MultiHook>; + run: MultiHook>; + watchClose: SyncHook_2; + watchRun: MultiHook; + infrastructureLog: MultiHook; + }; + // (undocumented) + infrastructureLogger: Any; + // (undocumented) + get inputFileSystem(): void; + set inputFileSystem(value: void); + // (undocumented) + get intermediateFileSystem(): any; + set intermediateFileSystem(value: any); + // (undocumented) + name: string; + // (undocumented) + get options(): RspackOptionsNormalized_2[] & { + parallelism?: number | undefined; + }; + // (undocumented) + _options: { + parallelism?: number; + }; + // (undocumented) + get outputFileSystem(): fs; + set outputFileSystem(value: fs); + // (undocumented) + get outputPath(): string; + // (undocumented) + purgeInputFileSystem(): void; + // (undocumented) + resolverFactory: ResolverFactory; + // (undocumented) + root: Compiler; + // (undocumented) + run(callback: Callback_2): void; + // (undocumented) + running: boolean; + // (undocumented) + setDependencies(compiler: Compiler, dependencies: string[]): void; + // (undocumented) + validateDependencies(callback: Callback_2): boolean; + // Warning: (ae-forgotten-export) The symbol "MultiWatching" needs to be exported by the entry point index.d.ts + // + // (undocumented) + watch(watchOptions: WatchOptions, handler: Callback_2): MultiWatching; + // (undocumented) + get watchFileSystem(): WatchFileSystem; + set watchFileSystem(value: WatchFileSystem); + // (undocumented) + watching: Watching; + // (undocumented) + watchMode: boolean; +} + +// @public (undocumented) +export interface MultiCompilerOptions { + parallelism?: number; +} + +// @public (undocumented) +export type MultiRspackOptions = ReadonlyArray & MultiCompilerOptions; + +// @public (undocumented) +export class MultiStats { + constructor(stats: Stats[]); + // (undocumented) + hasErrors(): boolean; + // (undocumented) + get hash(): string; + // (undocumented) + hasWarnings(): boolean; + // (undocumented) + stats: Stats[]; + // (undocumented) + toJson(options?: any): StatsCompilation; + // (undocumented) + toString(options: any): string; +} + +// Warning: (ae-forgotten-export) The symbol "name_2" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type Name = z.infer; + +// Warning: (ae-forgotten-export) The symbol "Node_3" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export const node: Node_3; + +// Warning: (ae-forgotten-export) The symbol "node_2" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type Node_2 = z.infer; +export { Node_2 as Node } + +// Warning: (ae-forgotten-export) The symbol "nodeOptions" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type NodeOptions = z.infer; + +// Warning: (ae-forgotten-export) The symbol "noParseOption" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type NoParseOption = z.infer; + +// @public (undocumented) +export class NormalModule { + constructor(); + // (undocumented) + static getCompilationHooks(compilation: Compilation): { + loader: SyncHook_2<[LoaderContext<{}>], void, UnsetAdditionalOptions_2>; + readResourceForScheme: any; + readResource: HookMap_2], string | Buffer, UnsetAdditionalOptions_2>>; + }; +} + +// @public (undocumented) +export class NormalModuleFactory { + constructor(); + // (undocumented) + hooks: { + resolveForScheme: liteTapable.HookMap>; + beforeResolve: liteTapable.AsyncSeriesBailHook<[ResolveData], false | void>; + afterResolve: liteTapable.AsyncSeriesBailHook<[ResolveData], false | void>; + createModule: liteTapable.AsyncSeriesBailHook<[ + NormalModuleCreateData, + {} + ], void>; + }; +} + +// @public (undocumented) +export class NormalModuleReplacementPlugin { + constructor(resourceRegExp: RegExp, newResource: string | ModuleReplacer); + // (undocumented) + apply(compiler: Compiler): void; + // Warning: (ae-forgotten-export) The symbol "ModuleReplacer" needs to be exported by the entry point index.d.ts + // + // (undocumented) + readonly newResource: string | ModuleReplacer; + // (undocumented) + readonly resourceRegExp: RegExp; +} + +// Warning: (ae-forgotten-export) The symbol "optimization" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type Optimization = z.infer; + +// Warning: (ae-forgotten-export) The symbol "optimizationRuntimeChunk" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type OptimizationRuntimeChunk = z.infer; + +// @public (undocumented) +export type OptimizationRuntimeChunkNormalized = false | { + name: (...args: any[]) => string | undefined; +}; + +// Warning: (ae-forgotten-export) The symbol "optimizationSplitChunksCacheGroup" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type OptimizationSplitChunksCacheGroup = z.infer; + +// Warning: (ae-forgotten-export) The symbol "optimizationSplitChunksNameFunction" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type OptimizationSplitChunksNameFunction = z.infer; + +// Warning: (ae-forgotten-export) The symbol "optimizationSplitChunksOptions" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type OptimizationSplitChunksOptions = z.infer; + +// Warning: (ae-forgotten-export) The symbol "Optimize" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export const optimize: Optimize; + +// Warning: (ae-forgotten-export) The symbol "output" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type Output = z.infer; + +// Warning: (ae-forgotten-export) The symbol "outputModule" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type OutputModule = z.infer; + +// @public (undocumented) +export interface OutputNormalized { + // (undocumented) + assetModuleFilename?: AssetModuleFilename; + // (undocumented) + asyncChunks?: boolean; + // (undocumented) + chunkFilename?: ChunkFilename; + // (undocumented) + chunkFormat?: string | false; + // (undocumented) + chunkLoading?: string | false; + // (undocumented) + chunkLoadingGlobal?: ChunkLoadingGlobal; + // (undocumented) + clean?: Clean; + // (undocumented) + crossOriginLoading?: CrossOriginLoading; + // (undocumented) + cssChunkFilename?: CssChunkFilename; + // (undocumented) + cssFilename?: CssFilename; + // (undocumented) + devtoolFallbackModuleFilenameTemplate?: DevtoolFallbackModuleFilenameTemplate; + // (undocumented) + devtoolModuleFilenameTemplate?: DevtoolModuleFilenameTemplate; + // (undocumented) + devtoolNamespace?: DevtoolNamespace; + // (undocumented) + enabledChunkLoadingTypes?: string[]; + // (undocumented) + enabledLibraryTypes?: EnabledLibraryTypes; + // (undocumented) + enabledWasmLoadingTypes?: EnabledWasmLoadingTypes; + // (undocumented) + filename?: Filename; + // (undocumented) + globalObject?: GlobalObject; + // (undocumented) + hashDigest?: HashDigest; + // (undocumented) + hashDigestLength?: HashDigestLength; + // (undocumented) + hashFunction?: HashFunction; + // (undocumented) + hashSalt?: HashSalt; + // (undocumented) + hotUpdateChunkFilename?: HotUpdateChunkFilename; + // (undocumented) + hotUpdateGlobal?: HotUpdateGlobal; + // (undocumented) + hotUpdateMainFilename?: HotUpdateMainFilename; + // (undocumented) + iife?: Iife; + // (undocumented) + importFunctionName?: ImportFunctionName; + // (undocumented) + library?: LibraryOptions; + // (undocumented) + module?: OutputModule; + // (undocumented) + path?: Path; + // (undocumented) + publicPath?: PublicPath; + // (undocumented) + scriptType?: ScriptType; + // (undocumented) + sourceMapFilename?: SourceMapFilename; + // (undocumented) + strictModuleErrorHandling?: StrictModuleErrorHandling; + // (undocumented) + trustedTypes?: TrustedTypes; + // (undocumented) + uniqueName?: UniqueName; + // (undocumented) + wasmLoading?: WasmLoading; + // (undocumented) + webassemblyModuleFilename?: WebassemblyModuleFilename; + // (undocumented) + workerChunkLoading?: ChunkLoading; + // (undocumented) + workerPublicPath?: WorkerPublicPath; + // (undocumented) + workerWasmLoading?: WasmLoading; +} + +// Warning: (ae-forgotten-export) The symbol "parserOptionsByModuleType" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type ParserOptionsByModuleType = z.infer; + +// Warning: (ae-forgotten-export) The symbol "parserOptionsByModuleTypeKnown" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type ParserOptionsByModuleTypeKnown = z.infer; + +// Warning: (ae-forgotten-export) The symbol "parserOptionsByModuleTypeUnknown" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type ParserOptionsByModuleTypeUnknown = z.infer; + +// Warning: (ae-forgotten-export) The symbol "path" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type Path = z.infer; + +// Warning: (ae-forgotten-export) The symbol "plugins" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type Plugins = z.infer; + +// Warning: (ae-forgotten-export) The symbol "profile" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type Profile = z.infer; + +// @public (undocumented) +export const ProgressPlugin: { + new (progress?: ProgressPluginArgument): { + name: BuiltinPluginName; + _options: RawProgressPluginOptions; + affectedHooks: "done" | "compilation" | "make" | "compile" | "emit" | "afterEmit" | "invalid" | "thisCompilation" | "afterDone" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "failed" | "shutdown" | "watchRun" | "watchClose" | "environment" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | undefined; + raw(): BuiltinPlugin; + apply(compiler: Compiler_2): void; + }; +}; + +// @public (undocumented) +export type ProgressPluginArgument = Partial | undefined; + +// @public (undocumented) +export const ProvidePlugin: { + new (provide: ProvidePluginOptions): { + name: BuiltinPluginName; + _options: Record; + affectedHooks: "done" | "compilation" | "make" | "compile" | "emit" | "afterEmit" | "invalid" | "thisCompilation" | "afterDone" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "failed" | "shutdown" | "watchRun" | "watchClose" | "environment" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | undefined; + raw(): BuiltinPlugin; + apply(compiler: Compiler_2): void; + }; +}; + +// @public (undocumented) +export type ProvidePluginOptions = Record; + +// @public (undocumented) +export type Provides = (ProvidesItem | ProvidesObject)[] | ProvidesObject; + +// @public (undocumented) +export type ProvidesConfig = { + eager?: boolean; + shareKey: string; + shareScope?: string; + version?: false | string; +}; + +// @public (undocumented) +export type ProvideSharedPluginOptions = { + provides: Provides; + shareScope?: string; + enhanced?: boolean; +}; + +// @public (undocumented) +export type ProvidesItem = string; + +// @public (undocumented) +export type ProvidesObject = { + [k: string]: ProvidesConfig | ProvidesItem; +}; + +// Warning: (ae-forgotten-export) The symbol "publicPath" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type PublicPath = z.infer; + +// Warning: (ae-forgotten-export) The symbol "rawPublicPath" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type RawPublicPath = z.infer; + +// @public (undocumented) +export type Remotes = (RemotesItem | RemotesObject)[] | RemotesObject; + +// @public (undocumented) +export type RemotesConfig = { + external: RemotesItem | RemotesItems; + shareScope?: string; +}; + +// @public (undocumented) +export type RemotesItem = string; + +// @public (undocumented) +export type RemotesItems = RemotesItem[]; + +// @public (undocumented) +export type RemotesObject = { + [k: string]: RemotesConfig | RemotesItem | RemotesItems; +}; + +// Warning: (ae-forgotten-export) The symbol "resolve" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type Resolve = z.infer; + +// Warning: (ae-forgotten-export) The symbol "resolveAlias" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type ResolveAlias = z.infer; + +// Warning: (ae-forgotten-export) The symbol "baseResolveOptions" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type ResolveOptions = z.infer & { + byDependency?: Record; +}; + +// Warning: (ae-forgotten-export) The symbol "resolveTsconfig" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type ResolveTsconfig = z.infer; + +// Warning: (ae-forgotten-export) The symbol "Rspack" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export const rspack: Rspack; + +// Warning: (ae-forgotten-export) The symbol "rspackFutureOptions" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type RspackFutureOptions = z.infer; + +// @public (undocumented) +export type RspackOptions = z.infer; + +// @public (undocumented) +export const rspackOptions: z.ZodObject<{ + name: z.ZodOptional; + dependencies: z.ZodOptional>; + entry: z.ZodOptional]>, z.ZodObject<{ + import: z.ZodUnion<[z.ZodString, z.ZodArray]>; + runtime: z.ZodOptional, z.ZodString]>>; + publicPath: z.ZodOptional, z.ZodString]>>; + baseUri: z.ZodOptional; + chunkLoading: z.ZodOptional, z.ZodUnion<[z.ZodEnum<["jsonp", "import-scripts", "require", "async-node", "import"]>, z.ZodString]>]>>; + asyncChunks: z.ZodOptional; + wasmLoading: z.ZodOptional, z.ZodUnion<[z.ZodEnum<["fetch-streaming", "fetch", "async-node"]>, z.ZodString]>]>>; + filename: z.ZodOptional; + library: z.ZodOptional; + auxiliaryComment: z.ZodOptional; + commonjs: z.ZodOptional; + commonjs2: z.ZodOptional; + root: z.ZodOptional; + }, "strict", z.ZodTypeAny, { + amd?: string | undefined; + commonjs?: string | undefined; + commonjs2?: string | undefined; + root?: string | undefined; + }, { + amd?: string | undefined; + commonjs?: string | undefined; + commonjs2?: string | undefined; + root?: string | undefined; + }>]>>; + export: z.ZodOptional]>>; + name: z.ZodOptional]>, z.ZodObject<{ + amd: z.ZodOptional; + commonjs: z.ZodOptional; + root: z.ZodOptional]>>; + }, "strict", z.ZodTypeAny, { + amd?: string | undefined; + commonjs?: string | undefined; + root?: string | string[] | undefined; + }, { + amd?: string | undefined; + commonjs?: string | undefined; + root?: string | string[] | undefined; + }>]>>; + type: z.ZodUnion<[z.ZodEnum<["var", "module", "assign", "assign-properties", "this", "window", "self", "global", "commonjs", "commonjs2", "commonjs-module", "commonjs-static", "amd", "amd-require", "umd", "umd2", "jsonp", "system"]>, z.ZodString]>; + umdNamedDefine: z.ZodOptional; + }, "strict", z.ZodTypeAny, { + type: string; + amdContainer?: string | undefined; + auxiliaryComment?: string | { + amd?: string | undefined; + commonjs?: string | undefined; + commonjs2?: string | undefined; + root?: string | undefined; + } | undefined; + export?: string | string[] | undefined; + name?: string | string[] | { + amd?: string | undefined; + commonjs?: string | undefined; + root?: string | string[] | undefined; + } | undefined; + umdNamedDefine?: boolean | undefined; + }, { + type: string; + amdContainer?: string | undefined; + auxiliaryComment?: string | { + amd?: string | undefined; + commonjs?: string | undefined; + commonjs2?: string | undefined; + root?: string | undefined; + } | undefined; + export?: string | string[] | undefined; + name?: string | string[] | { + amd?: string | undefined; + commonjs?: string | undefined; + root?: string | string[] | undefined; + } | undefined; + umdNamedDefine?: boolean | undefined; + }>>; + dependOn: z.ZodOptional]>>; + }, "strict", z.ZodTypeAny, { + import: (string | string[]) & (string | string[] | undefined); + runtime?: string | false | undefined; + publicPath?: string | undefined; + baseUri?: string | undefined; + chunkLoading?: string | false | undefined; + asyncChunks?: boolean | undefined; + wasmLoading?: string | false | undefined; + filename?: string | undefined; + library?: { + type: string; + amdContainer?: string | undefined; + auxiliaryComment?: string | { + amd?: string | undefined; + commonjs?: string | undefined; + commonjs2?: string | undefined; + root?: string | undefined; + } | undefined; + export?: string | string[] | undefined; + name?: string | string[] | { + amd?: string | undefined; + commonjs?: string | undefined; + root?: string | string[] | undefined; + } | undefined; + umdNamedDefine?: boolean | undefined; + } | undefined; + dependOn?: string | string[] | undefined; + }, { + import: (string | string[]) & (string | string[] | undefined); + runtime?: string | false | undefined; + publicPath?: string | undefined; + baseUri?: string | undefined; + chunkLoading?: string | false | undefined; + asyncChunks?: boolean | undefined; + wasmLoading?: string | false | undefined; + filename?: string | undefined; + library?: { + type: string; + amdContainer?: string | undefined; + auxiliaryComment?: string | { + amd?: string | undefined; + commonjs?: string | undefined; + commonjs2?: string | undefined; + root?: string | undefined; + } | undefined; + export?: string | string[] | undefined; + name?: string | string[] | { + amd?: string | undefined; + commonjs?: string | undefined; + root?: string | string[] | undefined; + } | undefined; + umdNamedDefine?: boolean | undefined; + } | undefined; + dependOn?: string | string[] | undefined; + }>]>>, z.ZodUnion<[z.ZodString, z.ZodArray]>]>, z.ZodFunction, z.ZodUnion<[z.ZodRecord]>, z.ZodObject<{ + import: z.ZodUnion<[z.ZodString, z.ZodArray]>; + runtime: z.ZodOptional, z.ZodString]>>; + publicPath: z.ZodOptional, z.ZodString]>>; + baseUri: z.ZodOptional; + chunkLoading: z.ZodOptional, z.ZodUnion<[z.ZodEnum<["jsonp", "import-scripts", "require", "async-node", "import"]>, z.ZodString]>]>>; + asyncChunks: z.ZodOptional; + wasmLoading: z.ZodOptional, z.ZodUnion<[z.ZodEnum<["fetch-streaming", "fetch", "async-node"]>, z.ZodString]>]>>; + filename: z.ZodOptional; + library: z.ZodOptional; + auxiliaryComment: z.ZodOptional; + commonjs: z.ZodOptional; + commonjs2: z.ZodOptional; + root: z.ZodOptional; + }, "strict", z.ZodTypeAny, { + amd?: string | undefined; + commonjs?: string | undefined; + commonjs2?: string | undefined; + root?: string | undefined; + }, { + amd?: string | undefined; + commonjs?: string | undefined; + commonjs2?: string | undefined; + root?: string | undefined; + }>]>>; + export: z.ZodOptional]>>; + name: z.ZodOptional]>, z.ZodObject<{ + amd: z.ZodOptional; + commonjs: z.ZodOptional; + root: z.ZodOptional]>>; + }, "strict", z.ZodTypeAny, { + amd?: string | undefined; + commonjs?: string | undefined; + root?: string | string[] | undefined; + }, { + amd?: string | undefined; + commonjs?: string | undefined; + root?: string | string[] | undefined; + }>]>>; + type: z.ZodUnion<[z.ZodEnum<["var", "module", "assign", "assign-properties", "this", "window", "self", "global", "commonjs", "commonjs2", "commonjs-module", "commonjs-static", "amd", "amd-require", "umd", "umd2", "jsonp", "system"]>, z.ZodString]>; + umdNamedDefine: z.ZodOptional; + }, "strict", z.ZodTypeAny, { + type: string; + amdContainer?: string | undefined; + auxiliaryComment?: string | { + amd?: string | undefined; + commonjs?: string | undefined; + commonjs2?: string | undefined; + root?: string | undefined; + } | undefined; + export?: string | string[] | undefined; + name?: string | string[] | { + amd?: string | undefined; + commonjs?: string | undefined; + root?: string | string[] | undefined; + } | undefined; + umdNamedDefine?: boolean | undefined; + }, { + type: string; + amdContainer?: string | undefined; + auxiliaryComment?: string | { + amd?: string | undefined; + commonjs?: string | undefined; + commonjs2?: string | undefined; + root?: string | undefined; + } | undefined; + export?: string | string[] | undefined; + name?: string | string[] | { + amd?: string | undefined; + commonjs?: string | undefined; + root?: string | string[] | undefined; + } | undefined; + umdNamedDefine?: boolean | undefined; + }>>; + dependOn: z.ZodOptional]>>; + }, "strict", z.ZodTypeAny, { + import: (string | string[]) & (string | string[] | undefined); + runtime?: string | false | undefined; + publicPath?: string | undefined; + baseUri?: string | undefined; + chunkLoading?: string | false | undefined; + asyncChunks?: boolean | undefined; + wasmLoading?: string | false | undefined; + filename?: string | undefined; + library?: { + type: string; + amdContainer?: string | undefined; + auxiliaryComment?: string | { + amd?: string | undefined; + commonjs?: string | undefined; + commonjs2?: string | undefined; + root?: string | undefined; + } | undefined; + export?: string | string[] | undefined; + name?: string | string[] | { + amd?: string | undefined; + commonjs?: string | undefined; + root?: string | string[] | undefined; + } | undefined; + umdNamedDefine?: boolean | undefined; + } | undefined; + dependOn?: string | string[] | undefined; + }, { + import: (string | string[]) & (string | string[] | undefined); + runtime?: string | false | undefined; + publicPath?: string | undefined; + baseUri?: string | undefined; + chunkLoading?: string | false | undefined; + asyncChunks?: boolean | undefined; + wasmLoading?: string | false | undefined; + filename?: string | undefined; + library?: { + type: string; + amdContainer?: string | undefined; + auxiliaryComment?: string | { + amd?: string | undefined; + commonjs?: string | undefined; + commonjs2?: string | undefined; + root?: string | undefined; + } | undefined; + export?: string | string[] | undefined; + name?: string | string[] | { + amd?: string | undefined; + commonjs?: string | undefined; + root?: string | string[] | undefined; + } | undefined; + umdNamedDefine?: boolean | undefined; + } | undefined; + dependOn?: string | string[] | undefined; + }>]>>, z.ZodUnion<[z.ZodString, z.ZodArray]>]>>]>>; + output: z.ZodOptional; + clean: z.ZodOptional; + publicPath: z.ZodOptional, z.ZodString]>>; + filename: z.ZodOptional, z.ZodOptional>], z.ZodUnknown>, z.ZodString>]>>; + chunkFilename: z.ZodOptional, z.ZodOptional>], z.ZodUnknown>, z.ZodString>]>>; + crossOriginLoading: z.ZodOptional, z.ZodEnum<["anonymous", "use-credentials"]>]>>; + cssFilename: z.ZodOptional, z.ZodOptional>], z.ZodUnknown>, z.ZodString>]>>; + cssChunkFilename: z.ZodOptional, z.ZodOptional>], z.ZodUnknown>, z.ZodString>]>>; + hotUpdateMainFilename: z.ZodOptional; + hotUpdateChunkFilename: z.ZodOptional; + hotUpdateGlobal: z.ZodOptional; + assetModuleFilename: z.ZodOptional; + uniqueName: z.ZodOptional; + chunkLoadingGlobal: z.ZodOptional; + enabledLibraryTypes: z.ZodOptional, z.ZodString]>, "many">>; + library: z.ZodOptional]>, z.ZodObject<{ + amd: z.ZodOptional; + commonjs: z.ZodOptional; + root: z.ZodOptional]>>; + }, "strict", z.ZodTypeAny, { + amd?: string | undefined; + commonjs?: string | undefined; + root?: string | string[] | undefined; + }, { + amd?: string | undefined; + commonjs?: string | undefined; + root?: string | string[] | undefined; + }>]>, z.ZodObject<{ + amdContainer: z.ZodOptional; + auxiliaryComment: z.ZodOptional; + commonjs: z.ZodOptional; + commonjs2: z.ZodOptional; + root: z.ZodOptional; + }, "strict", z.ZodTypeAny, { + amd?: string | undefined; + commonjs?: string | undefined; + commonjs2?: string | undefined; + root?: string | undefined; + }, { + amd?: string | undefined; + commonjs?: string | undefined; + commonjs2?: string | undefined; + root?: string | undefined; + }>]>>; + export: z.ZodOptional]>>; + name: z.ZodOptional]>, z.ZodObject<{ + amd: z.ZodOptional; + commonjs: z.ZodOptional; + root: z.ZodOptional]>>; + }, "strict", z.ZodTypeAny, { + amd?: string | undefined; + commonjs?: string | undefined; + root?: string | string[] | undefined; + }, { + amd?: string | undefined; + commonjs?: string | undefined; + root?: string | string[] | undefined; + }>]>>; + type: z.ZodUnion<[z.ZodEnum<["var", "module", "assign", "assign-properties", "this", "window", "self", "global", "commonjs", "commonjs2", "commonjs-module", "commonjs-static", "amd", "amd-require", "umd", "umd2", "jsonp", "system"]>, z.ZodString]>; + umdNamedDefine: z.ZodOptional; + }, "strict", z.ZodTypeAny, { + type: string; + amdContainer?: string | undefined; + auxiliaryComment?: string | { + amd?: string | undefined; + commonjs?: string | undefined; + commonjs2?: string | undefined; + root?: string | undefined; + } | undefined; + export?: string | string[] | undefined; + name?: string | string[] | { + amd?: string | undefined; + commonjs?: string | undefined; + root?: string | string[] | undefined; + } | undefined; + umdNamedDefine?: boolean | undefined; + }, { + type: string; + amdContainer?: string | undefined; + auxiliaryComment?: string | { + amd?: string | undefined; + commonjs?: string | undefined; + commonjs2?: string | undefined; + root?: string | undefined; + } | undefined; + export?: string | string[] | undefined; + name?: string | string[] | { + amd?: string | undefined; + commonjs?: string | undefined; + root?: string | string[] | undefined; + } | undefined; + umdNamedDefine?: boolean | undefined; + }>]>>>; + libraryExport: z.ZodOptional]>>; + libraryTarget: z.ZodOptional, z.ZodString]>>; + umdNamedDefine: z.ZodOptional; + amdContainer: z.ZodOptional; + auxiliaryComment: z.ZodOptional; + commonjs: z.ZodOptional; + commonjs2: z.ZodOptional; + root: z.ZodOptional; + }, "strict", z.ZodTypeAny, { + amd?: string | undefined; + commonjs?: string | undefined; + commonjs2?: string | undefined; + root?: string | undefined; + }, { + amd?: string | undefined; + commonjs?: string | undefined; + commonjs2?: string | undefined; + root?: string | undefined; + }>]>>; + module: z.ZodOptional; + strictModuleExceptionHandling: z.ZodOptional; + strictModuleErrorHandling: z.ZodOptional; + globalObject: z.ZodOptional; + importFunctionName: z.ZodOptional; + iife: z.ZodOptional; + wasmLoading: z.ZodOptional, z.ZodUnion<[z.ZodEnum<["fetch-streaming", "fetch", "async-node"]>, z.ZodString]>]>>; + enabledWasmLoadingTypes: z.ZodOptional, z.ZodString]>, "many">>; + webassemblyModuleFilename: z.ZodOptional; + chunkFormat: z.ZodOptional, z.ZodString]>>; + chunkLoading: z.ZodOptional, z.ZodUnion<[z.ZodEnum<["jsonp", "import-scripts", "require", "async-node", "import"]>, z.ZodString]>]>>; + enabledChunkLoadingTypes: z.ZodOptional, z.ZodString]>, "many">>; + trustedTypes: z.ZodOptional, z.ZodString]>, z.ZodObject<{ + policyName: z.ZodOptional; + }, "strict", z.ZodTypeAny, { + policyName?: string | undefined; + }, { + policyName?: string | undefined; + }>]>>; + sourceMapFilename: z.ZodOptional; + hashDigest: z.ZodOptional; + hashDigestLength: z.ZodOptional; + hashFunction: z.ZodOptional>; + hashSalt: z.ZodOptional; + asyncChunks: z.ZodOptional; + workerChunkLoading: z.ZodOptional, z.ZodUnion<[z.ZodEnum<["jsonp", "import-scripts", "require", "async-node", "import"]>, z.ZodString]>]>>; + workerWasmLoading: z.ZodOptional, z.ZodUnion<[z.ZodEnum<["fetch-streaming", "fetch", "async-node"]>, z.ZodString]>]>>; + workerPublicPath: z.ZodOptional; + scriptType: z.ZodOptional, z.ZodLiteral]>>; + devtoolNamespace: z.ZodOptional; + devtoolModuleFilenameTemplate: z.ZodOptional, z.ZodAny>]>>; + devtoolFallbackModuleFilenameTemplate: z.ZodOptional, z.ZodAny>]>>; + }, "strict", z.ZodTypeAny, { + path?: string | undefined; + clean?: boolean | undefined; + publicPath?: string | undefined; + filename?: string | ((args_0: PathData, args_1: JsAssetInfo | undefined, ...args_2: unknown[]) => string) | undefined; + chunkFilename?: string | ((args_0: PathData, args_1: JsAssetInfo | undefined, ...args_2: unknown[]) => string) | undefined; + crossOriginLoading?: false | "anonymous" | "use-credentials" | undefined; + cssFilename?: string | ((args_0: PathData, args_1: JsAssetInfo | undefined, ...args_2: unknown[]) => string) | undefined; + cssChunkFilename?: string | ((args_0: PathData, args_1: JsAssetInfo | undefined, ...args_2: unknown[]) => string) | undefined; + hotUpdateMainFilename?: string | undefined; + hotUpdateChunkFilename?: string | undefined; + hotUpdateGlobal?: string | undefined; + assetModuleFilename?: string | undefined; + uniqueName?: string | undefined; + chunkLoadingGlobal?: string | undefined; + enabledLibraryTypes?: string[] | undefined; + library?: string | string[] | { + amd?: string | undefined; + commonjs?: string | undefined; + root?: string | string[] | undefined; + } | { + type: string; + amdContainer?: string | undefined; + auxiliaryComment?: string | { + amd?: string | undefined; + commonjs?: string | undefined; + commonjs2?: string | undefined; + root?: string | undefined; + } | undefined; + export?: string | string[] | undefined; + name?: string | string[] | { + amd?: string | undefined; + commonjs?: string | undefined; + root?: string | string[] | undefined; + } | undefined; + umdNamedDefine?: boolean | undefined; + } | undefined; + libraryExport?: string | string[] | undefined; + libraryTarget?: string | undefined; + umdNamedDefine?: boolean | undefined; + amdContainer?: string | undefined; + auxiliaryComment?: string | { + amd?: string | undefined; + commonjs?: string | undefined; + commonjs2?: string | undefined; + root?: string | undefined; + } | undefined; + module?: boolean | undefined; + strictModuleExceptionHandling?: boolean | undefined; + strictModuleErrorHandling?: boolean | undefined; + globalObject?: string | undefined; + importFunctionName?: string | undefined; + iife?: boolean | undefined; + wasmLoading?: string | false | undefined; + enabledWasmLoadingTypes?: string[] | undefined; + webassemblyModuleFilename?: string | undefined; + chunkFormat?: string | false | undefined; + chunkLoading?: string | false | undefined; + enabledChunkLoadingTypes?: string[] | undefined; + trustedTypes?: string | true | { + policyName?: string | undefined; + } | undefined; + sourceMapFilename?: string | undefined; + hashDigest?: string | undefined; + hashDigestLength?: number | undefined; + hashFunction?: "md4" | "xxhash64" | undefined; + hashSalt?: string | undefined; + asyncChunks?: boolean | undefined; + workerChunkLoading?: string | false | undefined; + workerWasmLoading?: string | false | undefined; + workerPublicPath?: string | undefined; + scriptType?: false | "module" | "text/javascript" | undefined; + devtoolNamespace?: string | undefined; + devtoolModuleFilenameTemplate?: string | ((args_0: any) => any) | undefined; + devtoolFallbackModuleFilenameTemplate?: string | ((args_0: any) => any) | undefined; + }, { + path?: string | undefined; + clean?: boolean | undefined; + publicPath?: string | undefined; + filename?: string | ((args_0: PathData, args_1: JsAssetInfo | undefined, ...args_2: unknown[]) => string) | undefined; + chunkFilename?: string | ((args_0: PathData, args_1: JsAssetInfo | undefined, ...args_2: unknown[]) => string) | undefined; + crossOriginLoading?: false | "anonymous" | "use-credentials" | undefined; + cssFilename?: string | ((args_0: PathData, args_1: JsAssetInfo | undefined, ...args_2: unknown[]) => string) | undefined; + cssChunkFilename?: string | ((args_0: PathData, args_1: JsAssetInfo | undefined, ...args_2: unknown[]) => string) | undefined; + hotUpdateMainFilename?: string | undefined; + hotUpdateChunkFilename?: string | undefined; + hotUpdateGlobal?: string | undefined; + assetModuleFilename?: string | undefined; + uniqueName?: string | undefined; + chunkLoadingGlobal?: string | undefined; + enabledLibraryTypes?: string[] | undefined; + library?: string | string[] | { + amd?: string | undefined; + commonjs?: string | undefined; + root?: string | string[] | undefined; + } | { + type: string; + amdContainer?: string | undefined; + auxiliaryComment?: string | { + amd?: string | undefined; + commonjs?: string | undefined; + commonjs2?: string | undefined; + root?: string | undefined; + } | undefined; + export?: string | string[] | undefined; + name?: string | string[] | { + amd?: string | undefined; + commonjs?: string | undefined; + root?: string | string[] | undefined; + } | undefined; + umdNamedDefine?: boolean | undefined; + } | undefined; + libraryExport?: string | string[] | undefined; + libraryTarget?: string | undefined; + umdNamedDefine?: boolean | undefined; + amdContainer?: string | undefined; + auxiliaryComment?: string | { + amd?: string | undefined; + commonjs?: string | undefined; + commonjs2?: string | undefined; + root?: string | undefined; + } | undefined; + module?: boolean | undefined; + strictModuleExceptionHandling?: boolean | undefined; + strictModuleErrorHandling?: boolean | undefined; + globalObject?: string | undefined; + importFunctionName?: string | undefined; + iife?: boolean | undefined; + wasmLoading?: string | false | undefined; + enabledWasmLoadingTypes?: string[] | undefined; + webassemblyModuleFilename?: string | undefined; + chunkFormat?: string | false | undefined; + chunkLoading?: string | false | undefined; + enabledChunkLoadingTypes?: string[] | undefined; + trustedTypes?: string | true | { + policyName?: string | undefined; + } | undefined; + sourceMapFilename?: string | undefined; + hashDigest?: string | undefined; + hashDigestLength?: number | undefined; + hashFunction?: "md4" | "xxhash64" | undefined; + hashSalt?: string | undefined; + asyncChunks?: boolean | undefined; + workerChunkLoading?: string | false | undefined; + workerWasmLoading?: string | false | undefined; + workerPublicPath?: string | undefined; + scriptType?: false | "module" | "text/javascript" | undefined; + devtoolNamespace?: string | undefined; + devtoolModuleFilenameTemplate?: string | ((args_0: any) => any) | undefined; + devtoolFallbackModuleFilenameTemplate?: string | ((args_0: any) => any) | undefined; + }>>; + target: z.ZodOptional, z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodEnum<["web", "webworker", "es3", "es5", "es2015", "es2016", "es2017", "es2018", "es2019", "es2020", "es2021", "es2022", "browserslist"]>, z.ZodLiteral<"node">]>, z.ZodLiteral<"async-node">]>, z.ZodType<`node${number}`, z.ZodTypeDef, `node${number}`>]>, z.ZodType<`async-node${number}`, z.ZodTypeDef, `async-node${number}`>]>, z.ZodType<`node${number}.${number}`, z.ZodTypeDef, `node${number}.${number}`>]>, z.ZodType<`async-node${number}.${number}`, z.ZodTypeDef, `async-node${number}.${number}`>]>, z.ZodLiteral<"electron-main">]>, z.ZodType<`electron${number}-main`, z.ZodTypeDef, `electron${number}-main`>]>, z.ZodType<`electron${number}.${number}-main`, z.ZodTypeDef, `electron${number}.${number}-main`>]>, z.ZodLiteral<"electron-renderer">]>, z.ZodType<`electron${number}-renderer`, z.ZodTypeDef, `electron${number}-renderer`>]>, z.ZodType<`electron${number}.${number}-renderer`, z.ZodTypeDef, `electron${number}.${number}-renderer`>]>, z.ZodLiteral<"electron-preload">]>, z.ZodType<`electron${number}-preload`, z.ZodTypeDef, `electron${number}-preload`>]>, z.ZodType<`electron${number}.${number}-preload`, z.ZodTypeDef, `electron${number}.${number}-preload`>]>]>, z.ZodArray, z.ZodLiteral<"node">]>, z.ZodLiteral<"async-node">]>, z.ZodType<`node${number}`, z.ZodTypeDef, `node${number}`>]>, z.ZodType<`async-node${number}`, z.ZodTypeDef, `async-node${number}`>]>, z.ZodType<`node${number}.${number}`, z.ZodTypeDef, `node${number}.${number}`>]>, z.ZodType<`async-node${number}.${number}`, z.ZodTypeDef, `async-node${number}.${number}`>]>, z.ZodLiteral<"electron-main">]>, z.ZodType<`electron${number}-main`, z.ZodTypeDef, `electron${number}-main`>]>, z.ZodType<`electron${number}.${number}-main`, z.ZodTypeDef, `electron${number}.${number}-main`>]>, z.ZodLiteral<"electron-renderer">]>, z.ZodType<`electron${number}-renderer`, z.ZodTypeDef, `electron${number}-renderer`>]>, z.ZodType<`electron${number}.${number}-renderer`, z.ZodTypeDef, `electron${number}.${number}-renderer`>]>, z.ZodLiteral<"electron-preload">]>, z.ZodType<`electron${number}-preload`, z.ZodTypeDef, `electron${number}-preload`>]>, z.ZodType<`electron${number}.${number}-preload`, z.ZodTypeDef, `electron${number}.${number}-preload`>]>, "many">]>>; + mode: z.ZodOptional>; + experiments: z.ZodOptional; + asyncWebAssembly: z.ZodOptional; + outputModule: z.ZodOptional; + topLevelAwait: z.ZodOptional; + newSplitChunks: z.ZodEffects, boolean | undefined, boolean | undefined>; + css: z.ZodOptional; + futureDefaults: z.ZodOptional; + rspackFuture: z.ZodOptional; + bundlerInfo: z.ZodOptional; + force: z.ZodOptional, "many">]>>; + }, "strict", z.ZodTypeAny, { + version?: string | undefined; + force?: boolean | "version"[] | undefined; + }, { + version?: string | undefined; + force?: boolean | "version"[] | undefined; + }>>; + }, "strict", z.ZodTypeAny, { + newTreeshaking?: boolean | undefined; + bundlerInfo?: { + version?: string | undefined; + force?: boolean | "version"[] | undefined; + } | undefined; + }, { + newTreeshaking?: boolean | undefined; + bundlerInfo?: { + version?: string | undefined; + force?: boolean | "version"[] | undefined; + } | undefined; + }>>; + }, "strict", z.ZodTypeAny, { + lazyCompilation?: boolean | undefined; + asyncWebAssembly?: boolean | undefined; + outputModule?: boolean | undefined; + topLevelAwait?: boolean | undefined; + newSplitChunks?: boolean | undefined; + css?: boolean | undefined; + futureDefaults?: boolean | undefined; + rspackFuture?: { + newTreeshaking?: boolean | undefined; + bundlerInfo?: { + version?: string | undefined; + force?: boolean | "version"[] | undefined; + } | undefined; + } | undefined; + }, { + lazyCompilation?: boolean | undefined; + asyncWebAssembly?: boolean | undefined; + outputModule?: boolean | undefined; + topLevelAwait?: boolean | undefined; + newSplitChunks?: boolean | undefined; + css?: boolean | undefined; + futureDefaults?: boolean | undefined; + rspackFuture?: { + newTreeshaking?: boolean | undefined; + bundlerInfo?: { + version?: string | undefined; + force?: boolean | "version"[] | undefined; + } | undefined; + } | undefined; + }>>; + externals: z.ZodOptional]>, z.ZodRecord, z.ZodArray]>, z.ZodRecord]>>]>>]>, z.ZodFunction; + dependencyType: z.ZodOptional; + request: z.ZodOptional; + }, "strict", z.ZodTypeAny, { + context?: string | undefined; + dependencyType?: string | undefined; + request?: string | undefined; + }, { + context?: string | undefined; + dependencyType?: string | undefined; + request?: string | undefined; + }>, z.ZodFunction>, z.ZodOptional, z.ZodArray]>, z.ZodRecord]>>]>>, z.ZodOptional>], z.ZodUnknown>, z.ZodVoid>], z.ZodUnknown>, z.ZodUnknown>]>, z.ZodFunction; + dependencyType: z.ZodOptional; + request: z.ZodOptional; + }, "strict", z.ZodTypeAny, { + context?: string | undefined; + dependencyType?: string | undefined; + request?: string | undefined; + }, { + context?: string | undefined; + dependencyType?: string | undefined; + request?: string | undefined; + }>], z.ZodUnknown>, z.ZodPromise, z.ZodArray]>, z.ZodRecord]>>]>>>]>, "many">, z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodType]>, z.ZodRecord, z.ZodArray]>, z.ZodRecord]>>]>>]>, z.ZodFunction; + dependencyType: z.ZodOptional; + request: z.ZodOptional; + }, "strict", z.ZodTypeAny, { + context?: string | undefined; + dependencyType?: string | undefined; + request?: string | undefined; + }, { + context?: string | undefined; + dependencyType?: string | undefined; + request?: string | undefined; + }>, z.ZodFunction>, z.ZodOptional, z.ZodArray]>, z.ZodRecord]>>]>>, z.ZodOptional>], z.ZodUnknown>, z.ZodVoid>], z.ZodUnknown>, z.ZodUnknown>]>, z.ZodFunction; + dependencyType: z.ZodOptional; + request: z.ZodOptional; + }, "strict", z.ZodTypeAny, { + context?: string | undefined; + dependencyType?: string | undefined; + request?: string | undefined; + }, { + context?: string | undefined; + dependencyType?: string | undefined; + request?: string | undefined; + }>], z.ZodUnknown>, z.ZodPromise, z.ZodArray]>, z.ZodRecord]>>]>>>]>]>>; + externalsType: z.ZodOptional>; + externalsPresets: z.ZodOptional; + web: z.ZodOptional; + webAsync: z.ZodOptional; + electron: z.ZodOptional; + electronMain: z.ZodOptional; + electronPreload: z.ZodOptional; + electronRenderer: z.ZodOptional; + }, "strict", z.ZodTypeAny, { + node?: boolean | undefined; + web?: boolean | undefined; + webAsync?: boolean | undefined; + electron?: boolean | undefined; + electronMain?: boolean | undefined; + electronPreload?: boolean | undefined; + electronRenderer?: boolean | undefined; + }, { + node?: boolean | undefined; + web?: boolean | undefined; + webAsync?: boolean | undefined; + electron?: boolean | undefined; + electronMain?: boolean | undefined; + electronPreload?: boolean | undefined; + electronRenderer?: boolean | undefined; + }>>; + infrastructureLogging: z.ZodOptional; + colors: z.ZodOptional; + console: z.ZodOptional>; + debug: z.ZodOptional, z.ZodString]>, z.ZodFunction, z.ZodBoolean>]>, "many">, z.ZodUnion<[z.ZodUnion<[z.ZodType, z.ZodString]>, z.ZodFunction, z.ZodBoolean>]>]>]>>; + level: z.ZodOptional>; + stream: z.ZodOptional>; + }, "strict", z.ZodTypeAny, { + appendOnly?: boolean | undefined; + colors?: boolean | undefined; + console?: Console | undefined; + debug?: string | boolean | RegExp | ((args_0: string, ...args_1: unknown[]) => boolean) | (string | RegExp | ((args_0: string, ...args_1: unknown[]) => boolean))[] | undefined; + level?: "none" | "verbose" | "error" | "warn" | "info" | "log" | undefined; + stream?: NodeJS.WritableStream | undefined; + }, { + appendOnly?: boolean | undefined; + colors?: boolean | undefined; + console?: Console | undefined; + debug?: string | boolean | RegExp | ((args_0: string, ...args_1: unknown[]) => boolean) | (string | RegExp | ((args_0: string, ...args_1: unknown[]) => boolean))[] | undefined; + level?: "none" | "verbose" | "error" | "warn" | "info" | "log" | undefined; + stream?: NodeJS.WritableStream | undefined; + }>>; + cache: z.ZodOptional; + context: z.ZodOptional; + devtool: z.ZodOptional, z.ZodEnum<["eval", "cheap-source-map", "cheap-module-source-map", "source-map", "inline-cheap-source-map", "inline-cheap-module-source-map", "inline-source-map", "inline-nosources-cheap-source-map", "inline-nosources-cheap-module-source-map", "inline-nosources-source-map", "nosources-cheap-source-map", "nosources-cheap-module-source-map", "nosources-source-map", "hidden-nosources-cheap-source-map", "hidden-nosources-cheap-module-source-map", "hidden-nosources-source-map", "hidden-cheap-source-map", "hidden-cheap-module-source-map", "hidden-source-map", "eval-cheap-source-map", "eval-cheap-module-source-map", "eval-source-map", "eval-nosources-cheap-source-map", "eval-nosources-cheap-module-source-map", "eval-nosources-source-map"]>]>>; + node: z.ZodOptional, z.ZodObject<{ + __dirname: z.ZodOptional]>>; + __filename: z.ZodOptional]>>; + global: z.ZodOptional]>>; + }, "strict", z.ZodTypeAny, { + __dirname?: boolean | "warn-mock" | "mock" | "eval-only" | undefined; + __filename?: boolean | "warn-mock" | "mock" | "eval-only" | undefined; + global?: boolean | "warn" | undefined; + }, { + __dirname?: boolean | "warn-mock" | "mock" | "eval-only" | undefined; + __filename?: boolean | "warn-mock" | "mock" | "eval-only" | undefined; + global?: boolean | "warn" | undefined; + }>]>>; + ignoreWarnings: z.ZodOptional, z.ZodFunction, z.ZodType], z.ZodUnknown>, z.ZodBoolean>]>, "many">>; + watchOptions: z.ZodOptional; + followSymlinks: z.ZodOptional; + ignored: z.ZodOptional, z.ZodType]>, z.ZodString]>>; + poll: z.ZodOptional>; + stdin: z.ZodOptional; + }, "strict", z.ZodTypeAny, { + aggregateTimeout?: number | undefined; + followSymlinks?: boolean | undefined; + ignored?: string | RegExp | string[] | undefined; + poll?: number | boolean | undefined; + stdin?: boolean | undefined; + }, { + aggregateTimeout?: number | undefined; + followSymlinks?: boolean | undefined; + ignored?: string | RegExp | string[] | undefined; + poll?: number | boolean | undefined; + stdin?: boolean | undefined; + }>>; + watch: z.ZodOptional; + stats: z.ZodOptional, z.ZodBoolean]>, z.ZodObject<{ + all: z.ZodOptional; + preset: z.ZodOptional>; + assets: z.ZodOptional; + chunks: z.ZodOptional; + modules: z.ZodOptional; + entrypoints: z.ZodOptional; + chunkGroups: z.ZodOptional; + warnings: z.ZodOptional; + warningsCount: z.ZodOptional; + errors: z.ZodOptional; + errorsCount: z.ZodOptional; + colors: z.ZodOptional; + hash: z.ZodOptional; + version: z.ZodOptional; + reasons: z.ZodOptional; + publicPath: z.ZodOptional; + outputPath: z.ZodOptional; + chunkModules: z.ZodOptional; + chunkRelations: z.ZodOptional; + ids: z.ZodOptional; + timings: z.ZodOptional; + builtAt: z.ZodOptional; + moduleAssets: z.ZodOptional; + modulesSpace: z.ZodOptional; + nestedModules: z.ZodOptional; + source: z.ZodOptional; + logging: z.ZodOptional, z.ZodBoolean]>>; + loggingDebug: z.ZodOptional, z.ZodString]>, z.ZodFunction, z.ZodBoolean>]>, "many">, z.ZodUnion<[z.ZodUnion<[z.ZodType, z.ZodString]>, z.ZodFunction, z.ZodBoolean>]>]>]>>; + loggingTrace: z.ZodOptional; + runtimeModules: z.ZodOptional; + children: z.ZodOptional; + usedExports: z.ZodOptional; + providedExports: z.ZodOptional; + optimizationBailout: z.ZodOptional; + orphanModules: z.ZodOptional; + }, "strict", z.ZodTypeAny, { + all?: boolean | undefined; + preset?: "normal" | "none" | "verbose" | "errors-only" | "errors-warnings" | undefined; + assets?: boolean | undefined; + chunks?: boolean | undefined; + modules?: boolean | undefined; + entrypoints?: boolean | undefined; + chunkGroups?: boolean | undefined; + warnings?: boolean | undefined; + warningsCount?: boolean | undefined; + errors?: boolean | undefined; + errorsCount?: boolean | undefined; + colors?: boolean | undefined; + hash?: boolean | undefined; + version?: boolean | undefined; + reasons?: boolean | undefined; + publicPath?: boolean | undefined; + outputPath?: boolean | undefined; + chunkModules?: boolean | undefined; + chunkRelations?: boolean | undefined; + ids?: boolean | undefined; + timings?: boolean | undefined; + builtAt?: boolean | undefined; + moduleAssets?: boolean | undefined; + modulesSpace?: number | undefined; + nestedModules?: boolean | undefined; + source?: boolean | undefined; + logging?: boolean | "none" | "verbose" | "error" | "warn" | "info" | "log" | undefined; + loggingDebug?: string | boolean | RegExp | ((args_0: string, ...args_1: unknown[]) => boolean) | (string | RegExp | ((args_0: string, ...args_1: unknown[]) => boolean))[] | undefined; + loggingTrace?: boolean | undefined; + runtimeModules?: boolean | undefined; + children?: boolean | undefined; + usedExports?: boolean | undefined; + providedExports?: boolean | undefined; + optimizationBailout?: boolean | undefined; + orphanModules?: boolean | undefined; + }, { + all?: boolean | undefined; + preset?: "normal" | "none" | "verbose" | "errors-only" | "errors-warnings" | undefined; + assets?: boolean | undefined; + chunks?: boolean | undefined; + modules?: boolean | undefined; + entrypoints?: boolean | undefined; + chunkGroups?: boolean | undefined; + warnings?: boolean | undefined; + warningsCount?: boolean | undefined; + errors?: boolean | undefined; + errorsCount?: boolean | undefined; + colors?: boolean | undefined; + hash?: boolean | undefined; + version?: boolean | undefined; + reasons?: boolean | undefined; + publicPath?: boolean | undefined; + outputPath?: boolean | undefined; + chunkModules?: boolean | undefined; + chunkRelations?: boolean | undefined; + ids?: boolean | undefined; + timings?: boolean | undefined; + builtAt?: boolean | undefined; + moduleAssets?: boolean | undefined; + modulesSpace?: number | undefined; + nestedModules?: boolean | undefined; + source?: boolean | undefined; + logging?: boolean | "none" | "verbose" | "error" | "warn" | "info" | "log" | undefined; + loggingDebug?: string | boolean | RegExp | ((args_0: string, ...args_1: unknown[]) => boolean) | (string | RegExp | ((args_0: string, ...args_1: unknown[]) => boolean))[] | undefined; + loggingTrace?: boolean | undefined; + runtimeModules?: boolean | undefined; + children?: boolean | undefined; + usedExports?: boolean | undefined; + providedExports?: boolean | undefined; + optimizationBailout?: boolean | undefined; + orphanModules?: boolean | undefined; + }>]>>; + snapshot: z.ZodOptional; + timestamp: z.ZodOptional; + }, "strict", z.ZodTypeAny, { + hash?: boolean | undefined; + timestamp?: boolean | undefined; + }, { + hash?: boolean | undefined; + timestamp?: boolean | undefined; + }>>; + resolve: z.ZodOptional; + timestamp: z.ZodOptional; + }, "strict", z.ZodTypeAny, { + hash?: boolean | undefined; + timestamp?: boolean | undefined; + }, { + hash?: boolean | undefined; + timestamp?: boolean | undefined; + }>>; + }, "strict", z.ZodTypeAny, { + module?: { + hash?: boolean | undefined; + timestamp?: boolean | undefined; + } | undefined; + resolve?: { + hash?: boolean | undefined; + timestamp?: boolean | undefined; + } | undefined; + }, { + module?: { + hash?: boolean | undefined; + timestamp?: boolean | undefined; + } | undefined; + resolve?: { + hash?: boolean | undefined; + timestamp?: boolean | undefined; + } | undefined; + }>>; + optimization: z.ZodOptional>; + chunkIds: z.ZodOptional>; + minimize: z.ZodOptional; + minimizer: z.ZodOptional, z.ZodUnion<[z.ZodType, z.ZodType, z.ZodUnion<[z.ZodLiteral, z.ZodLiteral<0>, z.ZodLiteral<"">, z.ZodNull, z.ZodUndefined]>]>]>, "many">>; + mergeDuplicateChunks: z.ZodOptional; + splitChunks: z.ZodOptional, z.ZodObject<{ + chunks: z.ZodOptional, z.ZodType]>, z.ZodFunction], z.ZodUnknown>, z.ZodBoolean>]>>; + defaultSizeTypes: z.ZodOptional>; + minChunks: z.ZodOptional; + name: z.ZodOptional]>, z.ZodFunction>], z.ZodUnknown>, z.ZodUnknown>]>>; + minSize: z.ZodOptional; + maxSize: z.ZodOptional; + maxAsyncSize: z.ZodOptional; + maxInitialSize: z.ZodOptional; + automaticNameDelimiter: z.ZodOptional; + cacheGroups: z.ZodOptional, z.ZodObject<{ + chunks: z.ZodOptional, z.ZodType]>, z.ZodFunction], z.ZodUnknown>, z.ZodBoolean>]>>; + defaultSizeTypes: z.ZodOptional>; + minChunks: z.ZodOptional; + name: z.ZodOptional]>, z.ZodFunction>], z.ZodUnknown>, z.ZodUnknown>]>>; + minSize: z.ZodOptional; + maxSize: z.ZodOptional; + maxAsyncSize: z.ZodOptional; + maxInitialSize: z.ZodOptional; + automaticNameDelimiter: z.ZodOptional; + test: z.ZodOptional]>, z.ZodFunction], z.ZodUnknown>, z.ZodUnknown>]>>; + priority: z.ZodOptional; + enforce: z.ZodOptional; + filename: z.ZodOptional; + reuseExistingChunk: z.ZodOptional; + type: z.ZodOptional]>>; + idHint: z.ZodOptional; + }, "strict", z.ZodTypeAny, { + chunks?: RegExp | "async" | "all" | "initial" | ((args_0: Chunk, ...args_1: unknown[]) => boolean) | undefined; + defaultSizeTypes?: string[] | undefined; + minChunks?: number | undefined; + name?: string | false | ((args_0: Module | undefined, ...args_1: unknown[]) => unknown) | undefined; + minSize?: number | undefined; + maxSize?: number | undefined; + maxAsyncSize?: number | undefined; + maxInitialSize?: number | undefined; + automaticNameDelimiter?: string | undefined; + test?: string | RegExp | ((args_0: Module, ...args_1: unknown[]) => unknown) | undefined; + priority?: number | undefined; + enforce?: boolean | undefined; + filename?: string | undefined; + reuseExistingChunk?: boolean | undefined; + type?: string | RegExp | undefined; + idHint?: string | undefined; + }, { + chunks?: RegExp | "async" | "all" | "initial" | ((args_0: Chunk, ...args_1: unknown[]) => boolean) | undefined; + defaultSizeTypes?: string[] | undefined; + minChunks?: number | undefined; + name?: string | false | ((args_0: Module | undefined, ...args_1: unknown[]) => unknown) | undefined; + minSize?: number | undefined; + maxSize?: number | undefined; + maxAsyncSize?: number | undefined; + maxInitialSize?: number | undefined; + automaticNameDelimiter?: string | undefined; + test?: string | RegExp | ((args_0: Module, ...args_1: unknown[]) => unknown) | undefined; + priority?: number | undefined; + enforce?: boolean | undefined; + filename?: string | undefined; + reuseExistingChunk?: boolean | undefined; + type?: string | RegExp | undefined; + idHint?: string | undefined; + }>]>>>; + maxAsyncRequests: z.ZodOptional; + maxInitialRequests: z.ZodOptional; + fallbackCacheGroup: z.ZodOptional, z.ZodType]>, z.ZodFunction], z.ZodUnknown>, z.ZodBoolean>]>>; + minSize: z.ZodOptional; + maxSize: z.ZodOptional; + maxAsyncSize: z.ZodOptional; + maxInitialSize: z.ZodOptional; + automaticNameDelimiter: z.ZodOptional; + }, "strict", z.ZodTypeAny, { + chunks?: RegExp | "async" | "all" | "initial" | ((args_0: Chunk, ...args_1: unknown[]) => boolean) | undefined; + minSize?: number | undefined; + maxSize?: number | undefined; + maxAsyncSize?: number | undefined; + maxInitialSize?: number | undefined; + automaticNameDelimiter?: string | undefined; + }, { + chunks?: RegExp | "async" | "all" | "initial" | ((args_0: Chunk, ...args_1: unknown[]) => boolean) | undefined; + minSize?: number | undefined; + maxSize?: number | undefined; + maxAsyncSize?: number | undefined; + maxInitialSize?: number | undefined; + automaticNameDelimiter?: string | undefined; + }>>; + hidePathInfo: z.ZodOptional; + }, "strict", z.ZodTypeAny, { + chunks?: RegExp | "async" | "all" | "initial" | ((args_0: Chunk, ...args_1: unknown[]) => boolean) | undefined; + defaultSizeTypes?: string[] | undefined; + minChunks?: number | undefined; + name?: string | false | ((args_0: Module | undefined, ...args_1: unknown[]) => unknown) | undefined; + minSize?: number | undefined; + maxSize?: number | undefined; + maxAsyncSize?: number | undefined; + maxInitialSize?: number | undefined; + automaticNameDelimiter?: string | undefined; + cacheGroups?: Record boolean) | undefined; + defaultSizeTypes?: string[] | undefined; + minChunks?: number | undefined; + name?: string | false | ((args_0: Module | undefined, ...args_1: unknown[]) => unknown) | undefined; + minSize?: number | undefined; + maxSize?: number | undefined; + maxAsyncSize?: number | undefined; + maxInitialSize?: number | undefined; + automaticNameDelimiter?: string | undefined; + test?: string | RegExp | ((args_0: Module, ...args_1: unknown[]) => unknown) | undefined; + priority?: number | undefined; + enforce?: boolean | undefined; + filename?: string | undefined; + reuseExistingChunk?: boolean | undefined; + type?: string | RegExp | undefined; + idHint?: string | undefined; + }> | undefined; + maxAsyncRequests?: number | undefined; + maxInitialRequests?: number | undefined; + fallbackCacheGroup?: { + chunks?: RegExp | "async" | "all" | "initial" | ((args_0: Chunk, ...args_1: unknown[]) => boolean) | undefined; + minSize?: number | undefined; + maxSize?: number | undefined; + maxAsyncSize?: number | undefined; + maxInitialSize?: number | undefined; + automaticNameDelimiter?: string | undefined; + } | undefined; + hidePathInfo?: boolean | undefined; + }, { + chunks?: RegExp | "async" | "all" | "initial" | ((args_0: Chunk, ...args_1: unknown[]) => boolean) | undefined; + defaultSizeTypes?: string[] | undefined; + minChunks?: number | undefined; + name?: string | false | ((args_0: Module | undefined, ...args_1: unknown[]) => unknown) | undefined; + minSize?: number | undefined; + maxSize?: number | undefined; + maxAsyncSize?: number | undefined; + maxInitialSize?: number | undefined; + automaticNameDelimiter?: string | undefined; + cacheGroups?: Record boolean) | undefined; + defaultSizeTypes?: string[] | undefined; + minChunks?: number | undefined; + name?: string | false | ((args_0: Module | undefined, ...args_1: unknown[]) => unknown) | undefined; + minSize?: number | undefined; + maxSize?: number | undefined; + maxAsyncSize?: number | undefined; + maxInitialSize?: number | undefined; + automaticNameDelimiter?: string | undefined; + test?: string | RegExp | ((args_0: Module, ...args_1: unknown[]) => unknown) | undefined; + priority?: number | undefined; + enforce?: boolean | undefined; + filename?: string | undefined; + reuseExistingChunk?: boolean | undefined; + type?: string | RegExp | undefined; + idHint?: string | undefined; + }> | undefined; + maxAsyncRequests?: number | undefined; + maxInitialRequests?: number | undefined; + fallbackCacheGroup?: { + chunks?: RegExp | "async" | "all" | "initial" | ((args_0: Chunk, ...args_1: unknown[]) => boolean) | undefined; + minSize?: number | undefined; + maxSize?: number | undefined; + maxAsyncSize?: number | undefined; + maxInitialSize?: number | undefined; + automaticNameDelimiter?: string | undefined; + } | undefined; + hidePathInfo?: boolean | undefined; + }>]>>; + runtimeChunk: z.ZodOptional, z.ZodBoolean]>, z.ZodObject<{ + name: z.ZodOptional, z.ZodUnion<[z.ZodString, z.ZodUndefined]>>]>>; + }, "strict", z.ZodTypeAny, { + name?: string | ((...args: unknown[]) => string | undefined) | undefined; + }, { + name?: string | ((...args: unknown[]) => string | undefined) | undefined; + }>]>>; + removeAvailableModules: z.ZodOptional; + removeEmptyChunks: z.ZodOptional; + realContentHash: z.ZodOptional; + sideEffects: z.ZodOptional, z.ZodBoolean]>>; + providedExports: z.ZodOptional; + concatenateModules: z.ZodOptional; + innerGraph: z.ZodOptional; + usedExports: z.ZodOptional, z.ZodBoolean]>>; + mangleExports: z.ZodOptional, z.ZodBoolean]>>; + nodeEnv: z.ZodOptional]>>; + }, "strict", z.ZodTypeAny, { + moduleIds?: "named" | "deterministic" | undefined; + chunkIds?: "named" | "deterministic" | undefined; + minimize?: boolean | undefined; + minimizer?: (false | "" | 0 | "..." | RspackPluginInstance | RspackPluginFunction | null | undefined)[] | undefined; + mergeDuplicateChunks?: boolean | undefined; + splitChunks?: false | { + chunks?: RegExp | "async" | "all" | "initial" | ((args_0: Chunk, ...args_1: unknown[]) => boolean) | undefined; + defaultSizeTypes?: string[] | undefined; + minChunks?: number | undefined; + name?: string | false | ((args_0: Module | undefined, ...args_1: unknown[]) => unknown) | undefined; + minSize?: number | undefined; + maxSize?: number | undefined; + maxAsyncSize?: number | undefined; + maxInitialSize?: number | undefined; + automaticNameDelimiter?: string | undefined; + cacheGroups?: Record boolean) | undefined; + defaultSizeTypes?: string[] | undefined; + minChunks?: number | undefined; + name?: string | false | ((args_0: Module | undefined, ...args_1: unknown[]) => unknown) | undefined; + minSize?: number | undefined; + maxSize?: number | undefined; + maxAsyncSize?: number | undefined; + maxInitialSize?: number | undefined; + automaticNameDelimiter?: string | undefined; + test?: string | RegExp | ((args_0: Module, ...args_1: unknown[]) => unknown) | undefined; + priority?: number | undefined; + enforce?: boolean | undefined; + filename?: string | undefined; + reuseExistingChunk?: boolean | undefined; + type?: string | RegExp | undefined; + idHint?: string | undefined; + }> | undefined; + maxAsyncRequests?: number | undefined; + maxInitialRequests?: number | undefined; + fallbackCacheGroup?: { + chunks?: RegExp | "async" | "all" | "initial" | ((args_0: Chunk, ...args_1: unknown[]) => boolean) | undefined; + minSize?: number | undefined; + maxSize?: number | undefined; + maxAsyncSize?: number | undefined; + maxInitialSize?: number | undefined; + automaticNameDelimiter?: string | undefined; + } | undefined; + hidePathInfo?: boolean | undefined; + } | undefined; + runtimeChunk?: boolean | "single" | "multiple" | { + name?: string | ((...args: unknown[]) => string | undefined) | undefined; + } | undefined; + removeAvailableModules?: boolean | undefined; + removeEmptyChunks?: boolean | undefined; + realContentHash?: boolean | undefined; + sideEffects?: boolean | "flag" | undefined; + providedExports?: boolean | undefined; + concatenateModules?: boolean | undefined; + innerGraph?: boolean | undefined; + usedExports?: boolean | "global" | undefined; + mangleExports?: boolean | "size" | "deterministic" | undefined; + nodeEnv?: string | false | undefined; + }, { + moduleIds?: "named" | "deterministic" | undefined; + chunkIds?: "named" | "deterministic" | undefined; + minimize?: boolean | undefined; + minimizer?: (false | "" | 0 | "..." | RspackPluginInstance | RspackPluginFunction | null | undefined)[] | undefined; + mergeDuplicateChunks?: boolean | undefined; + splitChunks?: false | { + chunks?: RegExp | "async" | "all" | "initial" | ((args_0: Chunk, ...args_1: unknown[]) => boolean) | undefined; + defaultSizeTypes?: string[] | undefined; + minChunks?: number | undefined; + name?: string | false | ((args_0: Module | undefined, ...args_1: unknown[]) => unknown) | undefined; + minSize?: number | undefined; + maxSize?: number | undefined; + maxAsyncSize?: number | undefined; + maxInitialSize?: number | undefined; + automaticNameDelimiter?: string | undefined; + cacheGroups?: Record boolean) | undefined; + defaultSizeTypes?: string[] | undefined; + minChunks?: number | undefined; + name?: string | false | ((args_0: Module | undefined, ...args_1: unknown[]) => unknown) | undefined; + minSize?: number | undefined; + maxSize?: number | undefined; + maxAsyncSize?: number | undefined; + maxInitialSize?: number | undefined; + automaticNameDelimiter?: string | undefined; + test?: string | RegExp | ((args_0: Module, ...args_1: unknown[]) => unknown) | undefined; + priority?: number | undefined; + enforce?: boolean | undefined; + filename?: string | undefined; + reuseExistingChunk?: boolean | undefined; + type?: string | RegExp | undefined; + idHint?: string | undefined; + }> | undefined; + maxAsyncRequests?: number | undefined; + maxInitialRequests?: number | undefined; + fallbackCacheGroup?: { + chunks?: RegExp | "async" | "all" | "initial" | ((args_0: Chunk, ...args_1: unknown[]) => boolean) | undefined; + minSize?: number | undefined; + maxSize?: number | undefined; + maxAsyncSize?: number | undefined; + maxInitialSize?: number | undefined; + automaticNameDelimiter?: string | undefined; + } | undefined; + hidePathInfo?: boolean | undefined; + } | undefined; + runtimeChunk?: boolean | "single" | "multiple" | { + name?: string | ((...args: unknown[]) => string | undefined) | undefined; + } | undefined; + removeAvailableModules?: boolean | undefined; + removeEmptyChunks?: boolean | undefined; + realContentHash?: boolean | undefined; + sideEffects?: boolean | "flag" | undefined; + providedExports?: boolean | undefined; + concatenateModules?: boolean | undefined; + innerGraph?: boolean | undefined; + usedExports?: boolean | "global" | undefined; + mangleExports?: boolean | "size" | "deterministic" | undefined; + nodeEnv?: string | false | undefined; + }>>; + resolve: z.ZodOptional>; + resolveLoader: z.ZodOptional>; + plugins: z.ZodOptional, z.ZodType, z.ZodUnion<[z.ZodLiteral, z.ZodLiteral<0>, z.ZodLiteral<"">, z.ZodNull, z.ZodUndefined]>]>, "many">>; + devServer: z.ZodOptional>; + builtins: z.ZodOptional>; + module: z.ZodOptional, z.ZodType]>, z.ZodUnion<[z.ZodLiteral, z.ZodLiteral<0>, z.ZodLiteral<"">, z.ZodNull, z.ZodUndefined]>]>, "many">>; + rules: z.ZodOptional, z.ZodType]>, z.ZodUnion<[z.ZodLiteral, z.ZodLiteral<0>, z.ZodLiteral<"">, z.ZodNull, z.ZodUndefined]>]>, "many">>; + parser: z.ZodOptional; + }, "strict", z.ZodTypeAny, { + maxSize?: number | undefined; + }, { + maxSize?: number | undefined; + }>>; + }, "strict", z.ZodTypeAny, { + dataUrlCondition?: { + maxSize?: number | undefined; + } | undefined; + }, { + dataUrlCondition?: { + maxSize?: number | undefined; + } | undefined; + }>>; + css: z.ZodOptional; + }, "strict", z.ZodTypeAny, { + namedExports?: boolean | undefined; + }, { + namedExports?: boolean | undefined; + }>>; + "css/auto": z.ZodOptional; + }, "strict", z.ZodTypeAny, { + namedExports?: boolean | undefined; + }, { + namedExports?: boolean | undefined; + }>>; + "css/module": z.ZodOptional; + }, "strict", z.ZodTypeAny, { + namedExports?: boolean | undefined; + }, { + namedExports?: boolean | undefined; + }>>; + javascript: z.ZodOptional>; + dynamicImportPreload: z.ZodOptional>; + dynamicImportPrefetch: z.ZodOptional>; + url: z.ZodOptional, z.ZodBoolean]>>; + }, "strict", z.ZodTypeAny, { + dynamicImportMode?: "eager" | "lazy" | undefined; + dynamicImportPreload?: number | boolean | undefined; + dynamicImportPrefetch?: number | boolean | undefined; + url?: boolean | "relative" | undefined; + }, { + dynamicImportMode?: "eager" | "lazy" | undefined; + dynamicImportPreload?: number | boolean | undefined; + dynamicImportPrefetch?: number | boolean | undefined; + url?: boolean | "relative" | undefined; + }>>; + }, "strict", z.ZodTypeAny, { + asset?: { + dataUrlCondition?: { + maxSize?: number | undefined; + } | undefined; + } | undefined; + css?: { + namedExports?: boolean | undefined; + } | undefined; + "css/auto"?: { + namedExports?: boolean | undefined; + } | undefined; + "css/module"?: { + namedExports?: boolean | undefined; + } | undefined; + javascript?: { + dynamicImportMode?: "eager" | "lazy" | undefined; + dynamicImportPreload?: number | boolean | undefined; + dynamicImportPrefetch?: number | boolean | undefined; + url?: boolean | "relative" | undefined; + } | undefined; + }, { + asset?: { + dataUrlCondition?: { + maxSize?: number | undefined; + } | undefined; + } | undefined; + css?: { + namedExports?: boolean | undefined; + } | undefined; + "css/auto"?: { + namedExports?: boolean | undefined; + } | undefined; + "css/module"?: { + namedExports?: boolean | undefined; + } | undefined; + javascript?: { + dynamicImportMode?: "eager" | "lazy" | undefined; + dynamicImportPreload?: number | boolean | undefined; + dynamicImportPrefetch?: number | boolean | undefined; + url?: boolean | "relative" | undefined; + } | undefined; + }>, z.ZodRecord>]>>; + generator: z.ZodOptional, z.ZodLiteral<"base64">]>>; + mimetype: z.ZodOptional; + }, "strict", z.ZodTypeAny, { + encoding?: false | "base64" | undefined; + mimetype?: string | undefined; + }, { + encoding?: false | "base64" | undefined; + mimetype?: string | undefined; + }>, z.ZodFunction], z.ZodUnknown>, z.ZodString>]>>; + filename: z.ZodOptional; + publicPath: z.ZodOptional, z.ZodString]>>; + }, "strict", z.ZodTypeAny, { + dataUrl?: { + encoding?: false | "base64" | undefined; + mimetype?: string | undefined; + } | ((args_0: { + filename: string; + content: string; + }, ...args_1: unknown[]) => string) | undefined; + filename?: string | undefined; + publicPath?: string | undefined; + }, { + dataUrl?: { + encoding?: false | "base64" | undefined; + mimetype?: string | undefined; + } | ((args_0: { + filename: string; + content: string; + }, ...args_1: unknown[]) => string) | undefined; + filename?: string | undefined; + publicPath?: string | undefined; + }>>; + "asset/inline": z.ZodOptional, z.ZodLiteral<"base64">]>>; + mimetype: z.ZodOptional; + }, "strict", z.ZodTypeAny, { + encoding?: false | "base64" | undefined; + mimetype?: string | undefined; + }, { + encoding?: false | "base64" | undefined; + mimetype?: string | undefined; + }>, z.ZodFunction], z.ZodUnknown>, z.ZodString>]>>; + }, "strict", z.ZodTypeAny, { + dataUrl?: { + encoding?: false | "base64" | undefined; + mimetype?: string | undefined; + } | ((args_0: { + filename: string; + content: string; + }, ...args_1: unknown[]) => string) | undefined; + }, { + dataUrl?: { + encoding?: false | "base64" | undefined; + mimetype?: string | undefined; + } | ((args_0: { + filename: string; + content: string; + }, ...args_1: unknown[]) => string) | undefined; + }>>; + "asset/resource": z.ZodOptional; + publicPath: z.ZodOptional, z.ZodString]>>; + }, "strict", z.ZodTypeAny, { + filename?: string | undefined; + publicPath?: string | undefined; + }, { + filename?: string | undefined; + publicPath?: string | undefined; + }>>; + css: z.ZodOptional>; + exportsOnly: z.ZodOptional; + }, "strict", z.ZodTypeAny, { + exportsConvention?: "as-is" | "camel-case" | "camel-case-only" | "dashes" | "dashes-only" | undefined; + exportsOnly?: boolean | undefined; + }, { + exportsConvention?: "as-is" | "camel-case" | "camel-case-only" | "dashes" | "dashes-only" | undefined; + exportsOnly?: boolean | undefined; + }>>; + "css/auto": z.ZodOptional>; + exportsOnly: z.ZodOptional; + localIdentName: z.ZodOptional; + }, "strict", z.ZodTypeAny, { + exportsConvention?: "as-is" | "camel-case" | "camel-case-only" | "dashes" | "dashes-only" | undefined; + exportsOnly?: boolean | undefined; + localIdentName?: string | undefined; + }, { + exportsConvention?: "as-is" | "camel-case" | "camel-case-only" | "dashes" | "dashes-only" | undefined; + exportsOnly?: boolean | undefined; + localIdentName?: string | undefined; + }>>; + "css/module": z.ZodOptional>; + exportsOnly: z.ZodOptional; + localIdentName: z.ZodOptional; + }, "strict", z.ZodTypeAny, { + exportsConvention?: "as-is" | "camel-case" | "camel-case-only" | "dashes" | "dashes-only" | undefined; + exportsOnly?: boolean | undefined; + localIdentName?: string | undefined; + }, { + exportsConvention?: "as-is" | "camel-case" | "camel-case-only" | "dashes" | "dashes-only" | undefined; + exportsOnly?: boolean | undefined; + localIdentName?: string | undefined; + }>>; + }, "strict", z.ZodTypeAny, { + asset?: { + dataUrl?: { + encoding?: false | "base64" | undefined; + mimetype?: string | undefined; + } | ((args_0: { + filename: string; + content: string; + }, ...args_1: unknown[]) => string) | undefined; + filename?: string | undefined; + publicPath?: string | undefined; + } | undefined; + "asset/inline"?: { + dataUrl?: { + encoding?: false | "base64" | undefined; + mimetype?: string | undefined; + } | ((args_0: { + filename: string; + content: string; + }, ...args_1: unknown[]) => string) | undefined; + } | undefined; + "asset/resource"?: { + filename?: string | undefined; + publicPath?: string | undefined; + } | undefined; + css?: { + exportsConvention?: "as-is" | "camel-case" | "camel-case-only" | "dashes" | "dashes-only" | undefined; + exportsOnly?: boolean | undefined; + } | undefined; + "css/auto"?: { + exportsConvention?: "as-is" | "camel-case" | "camel-case-only" | "dashes" | "dashes-only" | undefined; + exportsOnly?: boolean | undefined; + localIdentName?: string | undefined; + } | undefined; + "css/module"?: { + exportsConvention?: "as-is" | "camel-case" | "camel-case-only" | "dashes" | "dashes-only" | undefined; + exportsOnly?: boolean | undefined; + localIdentName?: string | undefined; + } | undefined; + }, { + asset?: { + dataUrl?: { + encoding?: false | "base64" | undefined; + mimetype?: string | undefined; + } | ((args_0: { + filename: string; + content: string; + }, ...args_1: unknown[]) => string) | undefined; + filename?: string | undefined; + publicPath?: string | undefined; + } | undefined; + "asset/inline"?: { + dataUrl?: { + encoding?: false | "base64" | undefined; + mimetype?: string | undefined; + } | ((args_0: { + filename: string; + content: string; + }, ...args_1: unknown[]) => string) | undefined; + } | undefined; + "asset/resource"?: { + filename?: string | undefined; + publicPath?: string | undefined; + } | undefined; + css?: { + exportsConvention?: "as-is" | "camel-case" | "camel-case-only" | "dashes" | "dashes-only" | undefined; + exportsOnly?: boolean | undefined; + } | undefined; + "css/auto"?: { + exportsConvention?: "as-is" | "camel-case" | "camel-case-only" | "dashes" | "dashes-only" | undefined; + exportsOnly?: boolean | undefined; + localIdentName?: string | undefined; + } | undefined; + "css/module"?: { + exportsConvention?: "as-is" | "camel-case" | "camel-case-only" | "dashes" | "dashes-only" | undefined; + exportsOnly?: boolean | undefined; + localIdentName?: string | undefined; + } | undefined; + }>, z.ZodRecord>]>>; + noParse: z.ZodOptional]>, z.ZodFunction, z.ZodBoolean>]>, z.ZodArray]>, z.ZodFunction, z.ZodBoolean>]>, "many">]>>; + }, "strict", z.ZodTypeAny, { + defaultRules?: (false | "" | 0 | "..." | RuleSetRule | null | undefined)[] | undefined; + rules?: (false | "" | 0 | "..." | RuleSetRule | null | undefined)[] | undefined; + parser?: { + asset?: { + dataUrlCondition?: { + maxSize?: number | undefined; + } | undefined; + } | undefined; + css?: { + namedExports?: boolean | undefined; + } | undefined; + "css/auto"?: { + namedExports?: boolean | undefined; + } | undefined; + "css/module"?: { + namedExports?: boolean | undefined; + } | undefined; + javascript?: { + dynamicImportMode?: "eager" | "lazy" | undefined; + dynamicImportPreload?: number | boolean | undefined; + dynamicImportPrefetch?: number | boolean | undefined; + url?: boolean | "relative" | undefined; + } | undefined; + } | Record> | undefined; + generator?: Record> | { + asset?: { + dataUrl?: { + encoding?: false | "base64" | undefined; + mimetype?: string | undefined; + } | ((args_0: { + filename: string; + content: string; + }, ...args_1: unknown[]) => string) | undefined; + filename?: string | undefined; + publicPath?: string | undefined; + } | undefined; + "asset/inline"?: { + dataUrl?: { + encoding?: false | "base64" | undefined; + mimetype?: string | undefined; + } | ((args_0: { + filename: string; + content: string; + }, ...args_1: unknown[]) => string) | undefined; + } | undefined; + "asset/resource"?: { + filename?: string | undefined; + publicPath?: string | undefined; + } | undefined; + css?: { + exportsConvention?: "as-is" | "camel-case" | "camel-case-only" | "dashes" | "dashes-only" | undefined; + exportsOnly?: boolean | undefined; + } | undefined; + "css/auto"?: { + exportsConvention?: "as-is" | "camel-case" | "camel-case-only" | "dashes" | "dashes-only" | undefined; + exportsOnly?: boolean | undefined; + localIdentName?: string | undefined; + } | undefined; + "css/module"?: { + exportsConvention?: "as-is" | "camel-case" | "camel-case-only" | "dashes" | "dashes-only" | undefined; + exportsOnly?: boolean | undefined; + localIdentName?: string | undefined; + } | undefined; + } | undefined; + noParse?: string | RegExp | ((args_0: string, ...args_1: unknown[]) => boolean) | (string | RegExp | ((args_0: string, ...args_1: unknown[]) => boolean))[] | undefined; + }, { + defaultRules?: (false | "" | 0 | "..." | RuleSetRule | null | undefined)[] | undefined; + rules?: (false | "" | 0 | "..." | RuleSetRule | null | undefined)[] | undefined; + parser?: { + asset?: { + dataUrlCondition?: { + maxSize?: number | undefined; + } | undefined; + } | undefined; + css?: { + namedExports?: boolean | undefined; + } | undefined; + "css/auto"?: { + namedExports?: boolean | undefined; + } | undefined; + "css/module"?: { + namedExports?: boolean | undefined; + } | undefined; + javascript?: { + dynamicImportMode?: "eager" | "lazy" | undefined; + dynamicImportPreload?: number | boolean | undefined; + dynamicImportPrefetch?: number | boolean | undefined; + url?: boolean | "relative" | undefined; + } | undefined; + } | Record> | undefined; + generator?: Record> | { + asset?: { + dataUrl?: { + encoding?: false | "base64" | undefined; + mimetype?: string | undefined; + } | ((args_0: { + filename: string; + content: string; + }, ...args_1: unknown[]) => string) | undefined; + filename?: string | undefined; + publicPath?: string | undefined; + } | undefined; + "asset/inline"?: { + dataUrl?: { + encoding?: false | "base64" | undefined; + mimetype?: string | undefined; + } | ((args_0: { + filename: string; + content: string; + }, ...args_1: unknown[]) => string) | undefined; + } | undefined; + "asset/resource"?: { + filename?: string | undefined; + publicPath?: string | undefined; + } | undefined; + css?: { + exportsConvention?: "as-is" | "camel-case" | "camel-case-only" | "dashes" | "dashes-only" | undefined; + exportsOnly?: boolean | undefined; + } | undefined; + "css/auto"?: { + exportsConvention?: "as-is" | "camel-case" | "camel-case-only" | "dashes" | "dashes-only" | undefined; + exportsOnly?: boolean | undefined; + localIdentName?: string | undefined; + } | undefined; + "css/module"?: { + exportsConvention?: "as-is" | "camel-case" | "camel-case-only" | "dashes" | "dashes-only" | undefined; + exportsOnly?: boolean | undefined; + localIdentName?: string | undefined; + } | undefined; + } | undefined; + noParse?: string | RegExp | ((args_0: string, ...args_1: unknown[]) => boolean) | (string | RegExp | ((args_0: string, ...args_1: unknown[]) => boolean))[] | undefined; + }>>; + profile: z.ZodOptional; + bail: z.ZodOptional; +}, "strict", z.ZodTypeAny, { + name?: string | undefined; + dependencies?: string[] | undefined; + entry?: string | string[] | Record | ((...args: unknown[]) => string | string[] | Record) | undefined; + output?: { + path?: string | undefined; + clean?: boolean | undefined; + publicPath?: string | undefined; + filename?: string | ((args_0: PathData, args_1: JsAssetInfo | undefined, ...args_2: unknown[]) => string) | undefined; + chunkFilename?: string | ((args_0: PathData, args_1: JsAssetInfo | undefined, ...args_2: unknown[]) => string) | undefined; + crossOriginLoading?: false | "anonymous" | "use-credentials" | undefined; + cssFilename?: string | ((args_0: PathData, args_1: JsAssetInfo | undefined, ...args_2: unknown[]) => string) | undefined; + cssChunkFilename?: string | ((args_0: PathData, args_1: JsAssetInfo | undefined, ...args_2: unknown[]) => string) | undefined; + hotUpdateMainFilename?: string | undefined; + hotUpdateChunkFilename?: string | undefined; + hotUpdateGlobal?: string | undefined; + assetModuleFilename?: string | undefined; + uniqueName?: string | undefined; + chunkLoadingGlobal?: string | undefined; + enabledLibraryTypes?: string[] | undefined; + library?: string | string[] | { + amd?: string | undefined; + commonjs?: string | undefined; + root?: string | string[] | undefined; + } | { + type: string; + amdContainer?: string | undefined; + auxiliaryComment?: string | { + amd?: string | undefined; + commonjs?: string | undefined; + commonjs2?: string | undefined; + root?: string | undefined; + } | undefined; + export?: string | string[] | undefined; + name?: string | string[] | { + amd?: string | undefined; + commonjs?: string | undefined; + root?: string | string[] | undefined; + } | undefined; + umdNamedDefine?: boolean | undefined; + } | undefined; + libraryExport?: string | string[] | undefined; + libraryTarget?: string | undefined; + umdNamedDefine?: boolean | undefined; + amdContainer?: string | undefined; + auxiliaryComment?: string | { + amd?: string | undefined; + commonjs?: string | undefined; + commonjs2?: string | undefined; + root?: string | undefined; + } | undefined; + module?: boolean | undefined; + strictModuleExceptionHandling?: boolean | undefined; + strictModuleErrorHandling?: boolean | undefined; + globalObject?: string | undefined; + importFunctionName?: string | undefined; + iife?: boolean | undefined; + wasmLoading?: string | false | undefined; + enabledWasmLoadingTypes?: string[] | undefined; + webassemblyModuleFilename?: string | undefined; + chunkFormat?: string | false | undefined; + chunkLoading?: string | false | undefined; + enabledChunkLoadingTypes?: string[] | undefined; + trustedTypes?: string | true | { + policyName?: string | undefined; + } | undefined; + sourceMapFilename?: string | undefined; + hashDigest?: string | undefined; + hashDigestLength?: number | undefined; + hashFunction?: "md4" | "xxhash64" | undefined; + hashSalt?: string | undefined; + asyncChunks?: boolean | undefined; + workerChunkLoading?: string | false | undefined; + workerWasmLoading?: string | false | undefined; + workerPublicPath?: string | undefined; + scriptType?: false | "module" | "text/javascript" | undefined; + devtoolNamespace?: string | undefined; + devtoolModuleFilenameTemplate?: string | ((args_0: any) => any) | undefined; + devtoolFallbackModuleFilenameTemplate?: string | ((args_0: any) => any) | undefined; + } | undefined; + target?: false | "async-node" | "web" | "webworker" | "es3" | "es5" | "es2015" | "es2016" | "es2017" | "es2018" | "es2019" | "es2020" | "es2021" | "es2022" | "browserslist" | "node" | `node${number}` | `async-node${number}` | `node${number}.${number}` | `async-node${number}.${number}` | "electron-main" | `electron${number}-main` | `electron${number}.${number}-main` | "electron-renderer" | `electron${number}-renderer` | `electron${number}.${number}-renderer` | "electron-preload" | `electron${number}-preload` | `electron${number}.${number}-preload` | ("async-node" | "web" | "webworker" | "es3" | "es5" | "es2015" | "es2016" | "es2017" | "es2018" | "es2019" | "es2020" | "es2021" | "es2022" | "browserslist" | "node" | `node${number}` | `async-node${number}` | `node${number}.${number}` | `async-node${number}.${number}` | "electron-main" | `electron${number}-main` | `electron${number}.${number}-main` | "electron-renderer" | `electron${number}-renderer` | `electron${number}.${number}-renderer` | "electron-preload" | `electron${number}-preload` | `electron${number}.${number}-preload`)[] | undefined; + mode?: "none" | "development" | "production" | undefined; + experiments?: { + lazyCompilation?: boolean | undefined; + asyncWebAssembly?: boolean | undefined; + outputModule?: boolean | undefined; + topLevelAwait?: boolean | undefined; + newSplitChunks?: boolean | undefined; + css?: boolean | undefined; + futureDefaults?: boolean | undefined; + rspackFuture?: { + newTreeshaking?: boolean | undefined; + bundlerInfo?: { + version?: string | undefined; + force?: boolean | "version"[] | undefined; + } | undefined; + } | undefined; + } | undefined; + externals?: string | RegExp | Record> | ((args_0: { + context?: string | undefined; + dependencyType?: string | undefined; + request?: string | undefined; + }, args_1: (args_0: Error | undefined, args_1: string | boolean | string[] | Record | undefined, args_2: "promise" | "jsonp" | "import" | "amd" | "commonjs" | "commonjs2" | "var" | "module" | "assign" | "this" | "window" | "self" | "global" | "commonjs-module" | "commonjs-static" | "amd-require" | "umd" | "umd2" | "system" | "script" | "node-commonjs" | undefined, ...args_3: unknown[]) => void, ...args_2: unknown[]) => unknown) | ((args_0: { + context?: string | undefined; + dependencyType?: string | undefined; + request?: string | undefined; + }, ...args_1: unknown[]) => Promise>) | (string | RegExp | Record> | ((args_0: { + context?: string | undefined; + dependencyType?: string | undefined; + request?: string | undefined; + }, args_1: (args_0: Error | undefined, args_1: string | boolean | string[] | Record | undefined, args_2: "promise" | "jsonp" | "import" | "amd" | "commonjs" | "commonjs2" | "var" | "module" | "assign" | "this" | "window" | "self" | "global" | "commonjs-module" | "commonjs-static" | "amd-require" | "umd" | "umd2" | "system" | "script" | "node-commonjs" | undefined, ...args_3: unknown[]) => void, ...args_2: unknown[]) => unknown) | ((args_0: { + context?: string | undefined; + dependencyType?: string | undefined; + request?: string | undefined; + }, ...args_1: unknown[]) => Promise>))[] | undefined; + externalsType?: "promise" | "jsonp" | "import" | "amd" | "commonjs" | "commonjs2" | "var" | "module" | "assign" | "this" | "window" | "self" | "global" | "commonjs-module" | "commonjs-static" | "amd-require" | "umd" | "umd2" | "system" | "script" | "node-commonjs" | undefined; + externalsPresets?: { + node?: boolean | undefined; + web?: boolean | undefined; + webAsync?: boolean | undefined; + electron?: boolean | undefined; + electronMain?: boolean | undefined; + electronPreload?: boolean | undefined; + electronRenderer?: boolean | undefined; + } | undefined; + infrastructureLogging?: { + appendOnly?: boolean | undefined; + colors?: boolean | undefined; + console?: Console | undefined; + debug?: string | boolean | RegExp | ((args_0: string, ...args_1: unknown[]) => boolean) | (string | RegExp | ((args_0: string, ...args_1: unknown[]) => boolean))[] | undefined; + level?: "none" | "verbose" | "error" | "warn" | "info" | "log" | undefined; + stream?: NodeJS.WritableStream | undefined; + } | undefined; + cache?: boolean | undefined; + context?: string | undefined; + devtool?: false | "eval" | "cheap-source-map" | "cheap-module-source-map" | "source-map" | "inline-cheap-source-map" | "inline-cheap-module-source-map" | "inline-source-map" | "inline-nosources-cheap-source-map" | "inline-nosources-cheap-module-source-map" | "inline-nosources-source-map" | "nosources-cheap-source-map" | "nosources-cheap-module-source-map" | "nosources-source-map" | "hidden-nosources-cheap-source-map" | "hidden-nosources-cheap-module-source-map" | "hidden-nosources-source-map" | "hidden-cheap-source-map" | "hidden-cheap-module-source-map" | "hidden-source-map" | "eval-cheap-source-map" | "eval-cheap-module-source-map" | "eval-source-map" | "eval-nosources-cheap-source-map" | "eval-nosources-cheap-module-source-map" | "eval-nosources-source-map" | undefined; + node?: false | { + __dirname?: boolean | "warn-mock" | "mock" | "eval-only" | undefined; + __filename?: boolean | "warn-mock" | "mock" | "eval-only" | undefined; + global?: boolean | "warn" | undefined; + } | undefined; + ignoreWarnings?: (RegExp | ((args_0: Error, args_1: Compilation, ...args_2: unknown[]) => boolean))[] | undefined; + watchOptions?: { + aggregateTimeout?: number | undefined; + followSymlinks?: boolean | undefined; + ignored?: string | RegExp | string[] | undefined; + poll?: number | boolean | undefined; + stdin?: boolean | undefined; + } | undefined; + watch?: boolean | undefined; + stats?: boolean | "normal" | "none" | "verbose" | "errors-only" | "errors-warnings" | { + all?: boolean | undefined; + preset?: "normal" | "none" | "verbose" | "errors-only" | "errors-warnings" | undefined; + assets?: boolean | undefined; + chunks?: boolean | undefined; + modules?: boolean | undefined; + entrypoints?: boolean | undefined; + chunkGroups?: boolean | undefined; + warnings?: boolean | undefined; + warningsCount?: boolean | undefined; + errors?: boolean | undefined; + errorsCount?: boolean | undefined; + colors?: boolean | undefined; + hash?: boolean | undefined; + version?: boolean | undefined; + reasons?: boolean | undefined; + publicPath?: boolean | undefined; + outputPath?: boolean | undefined; + chunkModules?: boolean | undefined; + chunkRelations?: boolean | undefined; + ids?: boolean | undefined; + timings?: boolean | undefined; + builtAt?: boolean | undefined; + moduleAssets?: boolean | undefined; + modulesSpace?: number | undefined; + nestedModules?: boolean | undefined; + source?: boolean | undefined; + logging?: boolean | "none" | "verbose" | "error" | "warn" | "info" | "log" | undefined; + loggingDebug?: string | boolean | RegExp | ((args_0: string, ...args_1: unknown[]) => boolean) | (string | RegExp | ((args_0: string, ...args_1: unknown[]) => boolean))[] | undefined; + loggingTrace?: boolean | undefined; + runtimeModules?: boolean | undefined; + children?: boolean | undefined; + usedExports?: boolean | undefined; + providedExports?: boolean | undefined; + optimizationBailout?: boolean | undefined; + orphanModules?: boolean | undefined; + } | undefined; + snapshot?: { + module?: { + hash?: boolean | undefined; + timestamp?: boolean | undefined; + } | undefined; + resolve?: { + hash?: boolean | undefined; + timestamp?: boolean | undefined; + } | undefined; + } | undefined; + optimization?: { + moduleIds?: "named" | "deterministic" | undefined; + chunkIds?: "named" | "deterministic" | undefined; + minimize?: boolean | undefined; + minimizer?: (false | "" | 0 | "..." | RspackPluginInstance | RspackPluginFunction | null | undefined)[] | undefined; + mergeDuplicateChunks?: boolean | undefined; + splitChunks?: false | { + chunks?: RegExp | "async" | "all" | "initial" | ((args_0: Chunk, ...args_1: unknown[]) => boolean) | undefined; + defaultSizeTypes?: string[] | undefined; + minChunks?: number | undefined; + name?: string | false | ((args_0: Module | undefined, ...args_1: unknown[]) => unknown) | undefined; + minSize?: number | undefined; + maxSize?: number | undefined; + maxAsyncSize?: number | undefined; + maxInitialSize?: number | undefined; + automaticNameDelimiter?: string | undefined; + cacheGroups?: Record boolean) | undefined; + defaultSizeTypes?: string[] | undefined; + minChunks?: number | undefined; + name?: string | false | ((args_0: Module | undefined, ...args_1: unknown[]) => unknown) | undefined; + minSize?: number | undefined; + maxSize?: number | undefined; + maxAsyncSize?: number | undefined; + maxInitialSize?: number | undefined; + automaticNameDelimiter?: string | undefined; + test?: string | RegExp | ((args_0: Module, ...args_1: unknown[]) => unknown) | undefined; + priority?: number | undefined; + enforce?: boolean | undefined; + filename?: string | undefined; + reuseExistingChunk?: boolean | undefined; + type?: string | RegExp | undefined; + idHint?: string | undefined; + }> | undefined; + maxAsyncRequests?: number | undefined; + maxInitialRequests?: number | undefined; + fallbackCacheGroup?: { + chunks?: RegExp | "async" | "all" | "initial" | ((args_0: Chunk, ...args_1: unknown[]) => boolean) | undefined; + minSize?: number | undefined; + maxSize?: number | undefined; + maxAsyncSize?: number | undefined; + maxInitialSize?: number | undefined; + automaticNameDelimiter?: string | undefined; + } | undefined; + hidePathInfo?: boolean | undefined; + } | undefined; + runtimeChunk?: boolean | "single" | "multiple" | { + name?: string | ((...args: unknown[]) => string | undefined) | undefined; + } | undefined; + removeAvailableModules?: boolean | undefined; + removeEmptyChunks?: boolean | undefined; + realContentHash?: boolean | undefined; + sideEffects?: boolean | "flag" | undefined; + providedExports?: boolean | undefined; + concatenateModules?: boolean | undefined; + innerGraph?: boolean | undefined; + usedExports?: boolean | "global" | undefined; + mangleExports?: boolean | "size" | "deterministic" | undefined; + nodeEnv?: string | false | undefined; + } | undefined; + resolve?: ResolveOptions | undefined; + resolveLoader?: ResolveOptions | undefined; + plugins?: (false | "" | 0 | RspackPluginInstance | RspackPluginFunction | null | undefined)[] | undefined; + devServer?: DevServer | undefined; + builtins?: oldBuiltins.Builtins | undefined; + module?: { + defaultRules?: (false | "" | 0 | "..." | RuleSetRule | null | undefined)[] | undefined; + rules?: (false | "" | 0 | "..." | RuleSetRule | null | undefined)[] | undefined; + parser?: { + asset?: { + dataUrlCondition?: { + maxSize?: number | undefined; + } | undefined; + } | undefined; + css?: { + namedExports?: boolean | undefined; + } | undefined; + "css/auto"?: { + namedExports?: boolean | undefined; + } | undefined; + "css/module"?: { + namedExports?: boolean | undefined; + } | undefined; + javascript?: { + dynamicImportMode?: "eager" | "lazy" | undefined; + dynamicImportPreload?: number | boolean | undefined; + dynamicImportPrefetch?: number | boolean | undefined; + url?: boolean | "relative" | undefined; + } | undefined; + } | Record> | undefined; + generator?: Record> | { + asset?: { + dataUrl?: { + encoding?: false | "base64" | undefined; + mimetype?: string | undefined; + } | ((args_0: { + filename: string; + content: string; + }, ...args_1: unknown[]) => string) | undefined; + filename?: string | undefined; + publicPath?: string | undefined; + } | undefined; + "asset/inline"?: { + dataUrl?: { + encoding?: false | "base64" | undefined; + mimetype?: string | undefined; + } | ((args_0: { + filename: string; + content: string; + }, ...args_1: unknown[]) => string) | undefined; + } | undefined; + "asset/resource"?: { + filename?: string | undefined; + publicPath?: string | undefined; + } | undefined; + css?: { + exportsConvention?: "as-is" | "camel-case" | "camel-case-only" | "dashes" | "dashes-only" | undefined; + exportsOnly?: boolean | undefined; + } | undefined; + "css/auto"?: { + exportsConvention?: "as-is" | "camel-case" | "camel-case-only" | "dashes" | "dashes-only" | undefined; + exportsOnly?: boolean | undefined; + localIdentName?: string | undefined; + } | undefined; + "css/module"?: { + exportsConvention?: "as-is" | "camel-case" | "camel-case-only" | "dashes" | "dashes-only" | undefined; + exportsOnly?: boolean | undefined; + localIdentName?: string | undefined; + } | undefined; + } | undefined; + noParse?: string | RegExp | ((args_0: string, ...args_1: unknown[]) => boolean) | (string | RegExp | ((args_0: string, ...args_1: unknown[]) => boolean))[] | undefined; + } | undefined; + profile?: boolean | undefined; + bail?: boolean | undefined; +}, { + name?: string | undefined; + dependencies?: string[] | undefined; + entry?: string | string[] | Record | ((...args: unknown[]) => string | string[] | Record) | undefined; + output?: { + path?: string | undefined; + clean?: boolean | undefined; + publicPath?: string | undefined; + filename?: string | ((args_0: PathData, args_1: JsAssetInfo | undefined, ...args_2: unknown[]) => string) | undefined; + chunkFilename?: string | ((args_0: PathData, args_1: JsAssetInfo | undefined, ...args_2: unknown[]) => string) | undefined; + crossOriginLoading?: false | "anonymous" | "use-credentials" | undefined; + cssFilename?: string | ((args_0: PathData, args_1: JsAssetInfo | undefined, ...args_2: unknown[]) => string) | undefined; + cssChunkFilename?: string | ((args_0: PathData, args_1: JsAssetInfo | undefined, ...args_2: unknown[]) => string) | undefined; + hotUpdateMainFilename?: string | undefined; + hotUpdateChunkFilename?: string | undefined; + hotUpdateGlobal?: string | undefined; + assetModuleFilename?: string | undefined; + uniqueName?: string | undefined; + chunkLoadingGlobal?: string | undefined; + enabledLibraryTypes?: string[] | undefined; + library?: string | string[] | { + amd?: string | undefined; + commonjs?: string | undefined; + root?: string | string[] | undefined; + } | { + type: string; + amdContainer?: string | undefined; + auxiliaryComment?: string | { + amd?: string | undefined; + commonjs?: string | undefined; + commonjs2?: string | undefined; + root?: string | undefined; + } | undefined; + export?: string | string[] | undefined; + name?: string | string[] | { + amd?: string | undefined; + commonjs?: string | undefined; + root?: string | string[] | undefined; + } | undefined; + umdNamedDefine?: boolean | undefined; + } | undefined; + libraryExport?: string | string[] | undefined; + libraryTarget?: string | undefined; + umdNamedDefine?: boolean | undefined; + amdContainer?: string | undefined; + auxiliaryComment?: string | { + amd?: string | undefined; + commonjs?: string | undefined; + commonjs2?: string | undefined; + root?: string | undefined; + } | undefined; + module?: boolean | undefined; + strictModuleExceptionHandling?: boolean | undefined; + strictModuleErrorHandling?: boolean | undefined; + globalObject?: string | undefined; + importFunctionName?: string | undefined; + iife?: boolean | undefined; + wasmLoading?: string | false | undefined; + enabledWasmLoadingTypes?: string[] | undefined; + webassemblyModuleFilename?: string | undefined; + chunkFormat?: string | false | undefined; + chunkLoading?: string | false | undefined; + enabledChunkLoadingTypes?: string[] | undefined; + trustedTypes?: string | true | { + policyName?: string | undefined; + } | undefined; + sourceMapFilename?: string | undefined; + hashDigest?: string | undefined; + hashDigestLength?: number | undefined; + hashFunction?: "md4" | "xxhash64" | undefined; + hashSalt?: string | undefined; + asyncChunks?: boolean | undefined; + workerChunkLoading?: string | false | undefined; + workerWasmLoading?: string | false | undefined; + workerPublicPath?: string | undefined; + scriptType?: false | "module" | "text/javascript" | undefined; + devtoolNamespace?: string | undefined; + devtoolModuleFilenameTemplate?: string | ((args_0: any) => any) | undefined; + devtoolFallbackModuleFilenameTemplate?: string | ((args_0: any) => any) | undefined; + } | undefined; + target?: false | "async-node" | "web" | "webworker" | "es3" | "es5" | "es2015" | "es2016" | "es2017" | "es2018" | "es2019" | "es2020" | "es2021" | "es2022" | "browserslist" | "node" | `node${number}` | `async-node${number}` | `node${number}.${number}` | `async-node${number}.${number}` | "electron-main" | `electron${number}-main` | `electron${number}.${number}-main` | "electron-renderer" | `electron${number}-renderer` | `electron${number}.${number}-renderer` | "electron-preload" | `electron${number}-preload` | `electron${number}.${number}-preload` | ("async-node" | "web" | "webworker" | "es3" | "es5" | "es2015" | "es2016" | "es2017" | "es2018" | "es2019" | "es2020" | "es2021" | "es2022" | "browserslist" | "node" | `node${number}` | `async-node${number}` | `node${number}.${number}` | `async-node${number}.${number}` | "electron-main" | `electron${number}-main` | `electron${number}.${number}-main` | "electron-renderer" | `electron${number}-renderer` | `electron${number}.${number}-renderer` | "electron-preload" | `electron${number}-preload` | `electron${number}.${number}-preload`)[] | undefined; + mode?: "none" | "development" | "production" | undefined; + experiments?: { + lazyCompilation?: boolean | undefined; + asyncWebAssembly?: boolean | undefined; + outputModule?: boolean | undefined; + topLevelAwait?: boolean | undefined; + newSplitChunks?: boolean | undefined; + css?: boolean | undefined; + futureDefaults?: boolean | undefined; + rspackFuture?: { + newTreeshaking?: boolean | undefined; + bundlerInfo?: { + version?: string | undefined; + force?: boolean | "version"[] | undefined; + } | undefined; + } | undefined; + } | undefined; + externals?: string | RegExp | Record> | ((args_0: { + context?: string | undefined; + dependencyType?: string | undefined; + request?: string | undefined; + }, args_1: (args_0: Error | undefined, args_1: string | boolean | string[] | Record | undefined, args_2: "promise" | "jsonp" | "import" | "amd" | "commonjs" | "commonjs2" | "var" | "module" | "assign" | "this" | "window" | "self" | "global" | "commonjs-module" | "commonjs-static" | "amd-require" | "umd" | "umd2" | "system" | "script" | "node-commonjs" | undefined, ...args_3: unknown[]) => void, ...args_2: unknown[]) => unknown) | ((args_0: { + context?: string | undefined; + dependencyType?: string | undefined; + request?: string | undefined; + }, ...args_1: unknown[]) => Promise>) | (string | RegExp | Record> | ((args_0: { + context?: string | undefined; + dependencyType?: string | undefined; + request?: string | undefined; + }, args_1: (args_0: Error | undefined, args_1: string | boolean | string[] | Record | undefined, args_2: "promise" | "jsonp" | "import" | "amd" | "commonjs" | "commonjs2" | "var" | "module" | "assign" | "this" | "window" | "self" | "global" | "commonjs-module" | "commonjs-static" | "amd-require" | "umd" | "umd2" | "system" | "script" | "node-commonjs" | undefined, ...args_3: unknown[]) => void, ...args_2: unknown[]) => unknown) | ((args_0: { + context?: string | undefined; + dependencyType?: string | undefined; + request?: string | undefined; + }, ...args_1: unknown[]) => Promise>))[] | undefined; + externalsType?: "promise" | "jsonp" | "import" | "amd" | "commonjs" | "commonjs2" | "var" | "module" | "assign" | "this" | "window" | "self" | "global" | "commonjs-module" | "commonjs-static" | "amd-require" | "umd" | "umd2" | "system" | "script" | "node-commonjs" | undefined; + externalsPresets?: { + node?: boolean | undefined; + web?: boolean | undefined; + webAsync?: boolean | undefined; + electron?: boolean | undefined; + electronMain?: boolean | undefined; + electronPreload?: boolean | undefined; + electronRenderer?: boolean | undefined; + } | undefined; + infrastructureLogging?: { + appendOnly?: boolean | undefined; + colors?: boolean | undefined; + console?: Console | undefined; + debug?: string | boolean | RegExp | ((args_0: string, ...args_1: unknown[]) => boolean) | (string | RegExp | ((args_0: string, ...args_1: unknown[]) => boolean))[] | undefined; + level?: "none" | "verbose" | "error" | "warn" | "info" | "log" | undefined; + stream?: NodeJS.WritableStream | undefined; + } | undefined; + cache?: boolean | undefined; + context?: string | undefined; + devtool?: false | "eval" | "cheap-source-map" | "cheap-module-source-map" | "source-map" | "inline-cheap-source-map" | "inline-cheap-module-source-map" | "inline-source-map" | "inline-nosources-cheap-source-map" | "inline-nosources-cheap-module-source-map" | "inline-nosources-source-map" | "nosources-cheap-source-map" | "nosources-cheap-module-source-map" | "nosources-source-map" | "hidden-nosources-cheap-source-map" | "hidden-nosources-cheap-module-source-map" | "hidden-nosources-source-map" | "hidden-cheap-source-map" | "hidden-cheap-module-source-map" | "hidden-source-map" | "eval-cheap-source-map" | "eval-cheap-module-source-map" | "eval-source-map" | "eval-nosources-cheap-source-map" | "eval-nosources-cheap-module-source-map" | "eval-nosources-source-map" | undefined; + node?: false | { + __dirname?: boolean | "warn-mock" | "mock" | "eval-only" | undefined; + __filename?: boolean | "warn-mock" | "mock" | "eval-only" | undefined; + global?: boolean | "warn" | undefined; + } | undefined; + ignoreWarnings?: (RegExp | ((args_0: Error, args_1: Compilation, ...args_2: unknown[]) => boolean))[] | undefined; + watchOptions?: { + aggregateTimeout?: number | undefined; + followSymlinks?: boolean | undefined; + ignored?: string | RegExp | string[] | undefined; + poll?: number | boolean | undefined; + stdin?: boolean | undefined; + } | undefined; + watch?: boolean | undefined; + stats?: boolean | "normal" | "none" | "verbose" | "errors-only" | "errors-warnings" | { + all?: boolean | undefined; + preset?: "normal" | "none" | "verbose" | "errors-only" | "errors-warnings" | undefined; + assets?: boolean | undefined; + chunks?: boolean | undefined; + modules?: boolean | undefined; + entrypoints?: boolean | undefined; + chunkGroups?: boolean | undefined; + warnings?: boolean | undefined; + warningsCount?: boolean | undefined; + errors?: boolean | undefined; + errorsCount?: boolean | undefined; + colors?: boolean | undefined; + hash?: boolean | undefined; + version?: boolean | undefined; + reasons?: boolean | undefined; + publicPath?: boolean | undefined; + outputPath?: boolean | undefined; + chunkModules?: boolean | undefined; + chunkRelations?: boolean | undefined; + ids?: boolean | undefined; + timings?: boolean | undefined; + builtAt?: boolean | undefined; + moduleAssets?: boolean | undefined; + modulesSpace?: number | undefined; + nestedModules?: boolean | undefined; + source?: boolean | undefined; + logging?: boolean | "none" | "verbose" | "error" | "warn" | "info" | "log" | undefined; + loggingDebug?: string | boolean | RegExp | ((args_0: string, ...args_1: unknown[]) => boolean) | (string | RegExp | ((args_0: string, ...args_1: unknown[]) => boolean))[] | undefined; + loggingTrace?: boolean | undefined; + runtimeModules?: boolean | undefined; + children?: boolean | undefined; + usedExports?: boolean | undefined; + providedExports?: boolean | undefined; + optimizationBailout?: boolean | undefined; + orphanModules?: boolean | undefined; + } | undefined; + snapshot?: { + module?: { + hash?: boolean | undefined; + timestamp?: boolean | undefined; + } | undefined; + resolve?: { + hash?: boolean | undefined; + timestamp?: boolean | undefined; + } | undefined; + } | undefined; + optimization?: { + moduleIds?: "named" | "deterministic" | undefined; + chunkIds?: "named" | "deterministic" | undefined; + minimize?: boolean | undefined; + minimizer?: (false | "" | 0 | "..." | RspackPluginInstance | RspackPluginFunction | null | undefined)[] | undefined; + mergeDuplicateChunks?: boolean | undefined; + splitChunks?: false | { + chunks?: RegExp | "async" | "all" | "initial" | ((args_0: Chunk, ...args_1: unknown[]) => boolean) | undefined; + defaultSizeTypes?: string[] | undefined; + minChunks?: number | undefined; + name?: string | false | ((args_0: Module | undefined, ...args_1: unknown[]) => unknown) | undefined; + minSize?: number | undefined; + maxSize?: number | undefined; + maxAsyncSize?: number | undefined; + maxInitialSize?: number | undefined; + automaticNameDelimiter?: string | undefined; + cacheGroups?: Record boolean) | undefined; + defaultSizeTypes?: string[] | undefined; + minChunks?: number | undefined; + name?: string | false | ((args_0: Module | undefined, ...args_1: unknown[]) => unknown) | undefined; + minSize?: number | undefined; + maxSize?: number | undefined; + maxAsyncSize?: number | undefined; + maxInitialSize?: number | undefined; + automaticNameDelimiter?: string | undefined; + test?: string | RegExp | ((args_0: Module, ...args_1: unknown[]) => unknown) | undefined; + priority?: number | undefined; + enforce?: boolean | undefined; + filename?: string | undefined; + reuseExistingChunk?: boolean | undefined; + type?: string | RegExp | undefined; + idHint?: string | undefined; + }> | undefined; + maxAsyncRequests?: number | undefined; + maxInitialRequests?: number | undefined; + fallbackCacheGroup?: { + chunks?: RegExp | "async" | "all" | "initial" | ((args_0: Chunk, ...args_1: unknown[]) => boolean) | undefined; + minSize?: number | undefined; + maxSize?: number | undefined; + maxAsyncSize?: number | undefined; + maxInitialSize?: number | undefined; + automaticNameDelimiter?: string | undefined; + } | undefined; + hidePathInfo?: boolean | undefined; + } | undefined; + runtimeChunk?: boolean | "single" | "multiple" | { + name?: string | ((...args: unknown[]) => string | undefined) | undefined; + } | undefined; + removeAvailableModules?: boolean | undefined; + removeEmptyChunks?: boolean | undefined; + realContentHash?: boolean | undefined; + sideEffects?: boolean | "flag" | undefined; + providedExports?: boolean | undefined; + concatenateModules?: boolean | undefined; + innerGraph?: boolean | undefined; + usedExports?: boolean | "global" | undefined; + mangleExports?: boolean | "size" | "deterministic" | undefined; + nodeEnv?: string | false | undefined; + } | undefined; + resolve?: ResolveOptions | undefined; + resolveLoader?: ResolveOptions | undefined; + plugins?: (false | "" | 0 | RspackPluginInstance | RspackPluginFunction | null | undefined)[] | undefined; + devServer?: DevServer | undefined; + builtins?: oldBuiltins.Builtins | undefined; + module?: { + defaultRules?: (false | "" | 0 | "..." | RuleSetRule | null | undefined)[] | undefined; + rules?: (false | "" | 0 | "..." | RuleSetRule | null | undefined)[] | undefined; + parser?: { + asset?: { + dataUrlCondition?: { + maxSize?: number | undefined; + } | undefined; + } | undefined; + css?: { + namedExports?: boolean | undefined; + } | undefined; + "css/auto"?: { + namedExports?: boolean | undefined; + } | undefined; + "css/module"?: { + namedExports?: boolean | undefined; + } | undefined; + javascript?: { + dynamicImportMode?: "eager" | "lazy" | undefined; + dynamicImportPreload?: number | boolean | undefined; + dynamicImportPrefetch?: number | boolean | undefined; + url?: boolean | "relative" | undefined; + } | undefined; + } | Record> | undefined; + generator?: Record> | { + asset?: { + dataUrl?: { + encoding?: false | "base64" | undefined; + mimetype?: string | undefined; + } | ((args_0: { + filename: string; + content: string; + }, ...args_1: unknown[]) => string) | undefined; + filename?: string | undefined; + publicPath?: string | undefined; + } | undefined; + "asset/inline"?: { + dataUrl?: { + encoding?: false | "base64" | undefined; + mimetype?: string | undefined; + } | ((args_0: { + filename: string; + content: string; + }, ...args_1: unknown[]) => string) | undefined; + } | undefined; + "asset/resource"?: { + filename?: string | undefined; + publicPath?: string | undefined; + } | undefined; + css?: { + exportsConvention?: "as-is" | "camel-case" | "camel-case-only" | "dashes" | "dashes-only" | undefined; + exportsOnly?: boolean | undefined; + } | undefined; + "css/auto"?: { + exportsConvention?: "as-is" | "camel-case" | "camel-case-only" | "dashes" | "dashes-only" | undefined; + exportsOnly?: boolean | undefined; + localIdentName?: string | undefined; + } | undefined; + "css/module"?: { + exportsConvention?: "as-is" | "camel-case" | "camel-case-only" | "dashes" | "dashes-only" | undefined; + exportsOnly?: boolean | undefined; + localIdentName?: string | undefined; + } | undefined; + } | undefined; + noParse?: string | RegExp | ((args_0: string, ...args_1: unknown[]) => boolean) | (string | RegExp | ((args_0: string, ...args_1: unknown[]) => boolean))[] | undefined; + } | undefined; + profile?: boolean | undefined; + bail?: boolean | undefined; +}>; + +// @public (undocumented) +class RspackOptionsApply { + constructor(); + // (undocumented) + process(options: RspackOptionsNormalized, compiler: Compiler): void; +} +export { RspackOptionsApply } +export { RspackOptionsApply as WebpackOptionsApply } + +// @public (undocumented) +export interface RspackOptionsNormalized { + // (undocumented) + bail?: Bail; + // (undocumented) + builtins: Builtins; + // (undocumented) + cache?: CacheOptions; + // (undocumented) + context?: Context; + // (undocumented) + dependencies?: Dependencies; + // (undocumented) + devServer?: DevServer; + // (undocumented) + devtool?: DevTool; + // (undocumented) + entry: EntryNormalized; + // (undocumented) + experiments: ExperimentsNormalized; + // (undocumented) + externals?: Externals; + // (undocumented) + externalsPresets: ExternalsPresets; + // (undocumented) + externalsType?: ExternalsType; + // (undocumented) + ignoreWarnings?: IgnoreWarningsNormalized; + // (undocumented) + infrastructureLogging: InfrastructureLogging; + // (undocumented) + mode?: Mode; + // (undocumented) + module: ModuleOptionsNormalized; + // (undocumented) + name?: Name; + // (undocumented) + node: Node_2; + // (undocumented) + optimization: Optimization; + // (undocumented) + output: OutputNormalized; + // (undocumented) + plugins: Plugins; + // (undocumented) + profile?: Profile; + // (undocumented) + resolve: Resolve; + // (undocumented) + resolveLoader: Resolve; + // (undocumented) + snapshot: SnapshotOptions; + // (undocumented) + stats: StatsValue; + // (undocumented) + target?: Target; + // (undocumented) + watch?: Watch; + // (undocumented) + watchOptions: WatchOptions; +} + +// @public (undocumented) +export type RspackPluginFunction = (this: Compiler, compiler: Compiler) => void; + +// @public (undocumented) +export interface RspackPluginInstance { + // (undocumented) + [k: string]: any; + // (undocumented) + apply: (compiler: Compiler) => void; +} + +// @public (undocumented) +export const rspackVersion: any; + +// Warning: (ae-forgotten-export) The symbol "baseRuleSetCondition" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type RuleSetCondition = z.infer | RuleSetConditions | RuleSetLogicalConditions; + +// @public (undocumented) +export type RuleSetConditions = RuleSetCondition[]; + +// Warning: (ae-forgotten-export) The symbol "ruleSetLoader" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type RuleSetLoader = z.infer; + +// Warning: (ae-forgotten-export) The symbol "ruleSetLoaderOptions" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type RuleSetLoaderOptions = z.infer; + +// Warning: (ae-forgotten-export) The symbol "ruleSetLoaderWithOptions" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type RuleSetLoaderWithOptions = z.infer; + +// @public (undocumented) +export type RuleSetLogicalConditions = { + and?: RuleSetConditions; + or?: RuleSetConditions; + not?: RuleSetCondition; +}; + +// Warning: (ae-forgotten-export) The symbol "baseRuleSetRule" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type RuleSetRule = z.infer & { + oneOf?: RuleSetRule[]; + rules?: RuleSetRule[]; +}; + +// Warning: (ae-forgotten-export) The symbol "ruleSetRules" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type RuleSetRules = z.infer; + +// Warning: (ae-forgotten-export) The symbol "ruleSetUse" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type RuleSetUse = z.infer; + +// Warning: (ae-forgotten-export) The symbol "ruleSetUseItem" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type RuleSetUseItem = z.infer; + +// @public +export const RuntimeGlobals: { + readonly require: "__webpack_require__"; + readonly requireScope: "__webpack_require__.*"; + readonly exports: "__webpack_exports__"; + readonly thisAsExports: "top-level-this-exports"; + readonly returnExportsFromRuntime: "return-exports-from-runtime"; + readonly module: "module"; + readonly moduleId: "module.id"; + readonly moduleLoaded: "module.loaded"; + readonly publicPath: "__webpack_require__.p"; + readonly entryModuleId: "__webpack_require__.s"; + readonly moduleCache: "__webpack_require__.c"; + readonly moduleFactories: "__webpack_require__.m"; + readonly moduleFactoriesAddOnly: "__webpack_require__.m (add only)"; + readonly ensureChunk: "__webpack_require__.e"; + readonly ensureChunkHandlers: "__webpack_require__.f"; + readonly ensureChunkIncludeEntries: "__webpack_require__.f (include entries)"; + readonly prefetchChunk: "__webpack_require__.E"; + readonly prefetchChunkHandlers: "__webpack_require__.F"; + readonly preloadChunk: "__webpack_require__.G"; + readonly preloadChunkHandlers: "__webpack_require__.H"; + readonly definePropertyGetters: "__webpack_require__.d"; + readonly makeNamespaceObject: "__webpack_require__.r"; + readonly createFakeNamespaceObject: "__webpack_require__.t"; + readonly compatGetDefaultExport: "__webpack_require__.n"; + readonly harmonyModuleDecorator: "__webpack_require__.hmd"; + readonly nodeModuleDecorator: "__webpack_require__.nmd"; + readonly getFullHash: "__webpack_require__.h"; + readonly wasmInstances: "__webpack_require__.w"; + readonly instantiateWasm: "__webpack_require__.v"; + readonly uncaughtErrorHandler: "__webpack_require__.oe"; + readonly scriptNonce: "__webpack_require__.nc"; + readonly loadScript: "__webpack_require__.l"; + readonly createScript: "__webpack_require__.ts"; + readonly createScriptUrl: "__webpack_require__.tu"; + readonly getTrustedTypesPolicy: "__webpack_require__.tt"; + readonly hasFetchPriority: "has fetch priority"; + readonly chunkName: "__webpack_require__.cn"; + readonly runtimeId: "__webpack_require__.j"; + readonly getChunkScriptFilename: "__webpack_require__.u"; + readonly getChunkCssFilename: "__webpack_require__.k"; + readonly hasCssModules: "has css modules"; + readonly getChunkUpdateScriptFilename: "__webpack_require__.hu"; + readonly getChunkUpdateCssFilename: "__webpack_require__.hk"; + readonly startup: "__webpack_require__.x"; + readonly startupNoDefault: "__webpack_require__.x (no default handler)"; + readonly startupOnlyAfter: "__webpack_require__.x (only after)"; + readonly startupOnlyBefore: "__webpack_require__.x (only before)"; + readonly chunkCallback: "webpackChunk"; + readonly startupEntrypoint: "__webpack_require__.X"; + readonly onChunksLoaded: "__webpack_require__.O"; + readonly externalInstallChunk: "__webpack_require__.C"; + readonly interceptModuleExecution: "__webpack_require__.i"; + readonly global: "__webpack_require__.g"; + readonly shareScopeMap: "__webpack_require__.S"; + readonly initializeSharing: "__webpack_require__.I"; + readonly currentRemoteGetScope: "__webpack_require__.R"; + readonly getUpdateManifestFilename: "__webpack_require__.hmrF"; + readonly hmrDownloadManifest: "__webpack_require__.hmrM"; + readonly hmrDownloadUpdateHandlers: "__webpack_require__.hmrC"; + readonly hmrModuleData: "__webpack_require__.hmrD"; + readonly hmrInvalidateModuleHandlers: "__webpack_require__.hmrI"; + readonly hmrRuntimeStatePrefix: "__webpack_require__.hmrS"; + readonly amdDefine: "__webpack_require__.amdD"; + readonly amdOptions: "__webpack_require__.amdO"; + readonly system: "__webpack_require__.System"; + readonly hasOwnProperty: "__webpack_require__.o"; + readonly systemContext: "__webpack_require__.y"; + readonly baseURI: "__webpack_require__.b"; + readonly relativeUrl: "__webpack_require__.U"; + readonly asyncModule: "__webpack_require__.a"; +}; + +// Warning: (ae-forgotten-export) The symbol "scriptType" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type ScriptType = z.infer; + +// @public (undocumented) +export type Shared = (SharedItem | SharedObject)[] | SharedObject; + +// @public (undocumented) +export type SharedConfig = { + eager?: boolean; + import?: false | SharedItem; + packageName?: string; + requiredVersion?: false | string; + shareKey?: string; + shareScope?: string; + singleton?: boolean; + strictVersion?: boolean; + version?: false | string; +}; + +// @public (undocumented) +export type SharedItem = string; + +// @public (undocumented) +export type SharedObject = { + [k: string]: SharedConfig | SharedItem; +}; + +// @public (undocumented) +export type SharePluginOptions = { + shareScope?: string; + shared: Shared; + enhanced: boolean; +}; + +// @public (undocumented) +export const sharing: { + ProvideSharedPlugin: typeof ProvideSharedPlugin; + ConsumeSharedPlugin: typeof ConsumeSharedPlugin; + SharePlugin: typeof SharePlugin; +}; + +// Warning: (ae-forgotten-export) The symbol "snapshotOptions" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type SnapshotOptions = z.infer; + +// @public (undocumented) +export const SourceMapDevToolPlugin: { + new (options: SourceMapDevToolPluginOptions): { + name: BuiltinPluginName; + _options: RawSourceMapDevToolPluginOptions; + affectedHooks: "done" | "compilation" | "make" | "compile" | "emit" | "afterEmit" | "invalid" | "thisCompilation" | "afterDone" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "failed" | "shutdown" | "watchRun" | "watchClose" | "environment" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | undefined; + raw(): BuiltinPlugin; + apply(compiler: Compiler_2): void; + }; +}; + +// @public (undocumented) +export interface SourceMapDevToolPluginOptions extends Omit { + // Warning: (ae-forgotten-export) The symbol "Rules_2" needs to be exported by the entry point index.d.ts + // + // (undocumented) + exclude?: Rules_2; + // (undocumented) + include?: Rules_2; + // (undocumented) + test?: Rules_2; +} + +// Warning: (ae-forgotten-export) The symbol "sourceMapFilename" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type SourceMapFilename = z.infer; + +// @public (undocumented) +export const sources: any; + +// @public (undocumented) +export class Stats { + constructor(compilation: Compilation); + // (undocumented) + compilation: Compilation; + // (undocumented) + hasErrors(): boolean; + // (undocumented) + get hash(): string | null; + // (undocumented) + hasWarnings(): boolean; + // (undocumented) + toJson(opts?: StatsValue, forToString?: boolean): StatsCompilation; + // (undocumented) + toString(opts?: StatsValue): string; +} + +// Warning: (ae-forgotten-export) The symbol "KnownStatsAsset" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type StatsAsset = KnownStatsAsset & Record; + +// Warning: (ae-forgotten-export) The symbol "KnownStatsChunk" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type StatsChunk = KnownStatsChunk & Record; + +// Warning: (ae-forgotten-export) The symbol "KnownStatsCompilation" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type StatsCompilation = KnownStatsCompilation & Record; + +// @public (undocumented) +export type StatsError = binding.JsStatsError & Record; + +// Warning: (ae-forgotten-export) The symbol "KnownStatsModule" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type StatsModule = KnownStatsModule & Record; + +// Warning: (ae-forgotten-export) The symbol "statsOptions" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type StatsOptions = z.infer; + +// Warning: (ae-forgotten-export) The symbol "statsValue" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type StatsValue = z.infer; + +// @public (undocumented) +export type StatsWarnings = binding.JsStatsWarning & Record; + +// Warning: (ae-forgotten-export) The symbol "strictModuleErrorHandling" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type StrictModuleErrorHandling = z.infer; + +// Warning: (ae-forgotten-export) The symbol "strictModuleExceptionHandling" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type StrictModuleExceptionHandling = z.infer; + +// @public (undocumented) +export const SwcCssMinimizerRspackPlugin: { + new (options?: any): { + name: BuiltinPluginName; + _options: undefined; + affectedHooks: "done" | "compilation" | "make" | "compile" | "emit" | "afterEmit" | "invalid" | "thisCompilation" | "afterDone" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "failed" | "shutdown" | "watchRun" | "watchClose" | "environment" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | undefined; + raw(): BuiltinPlugin; + apply(compiler: Compiler_2): void; + }; +}; + +// @public (undocumented) +export const SwcJsMinimizerRspackPlugin: { + new (options?: SwcJsMinimizerRspackPluginOptions | undefined): { + name: BuiltinPluginName; + _options: RawSwcJsMinimizerRspackPluginOptions; + affectedHooks: "done" | "compilation" | "make" | "compile" | "emit" | "afterEmit" | "invalid" | "thisCompilation" | "afterDone" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "failed" | "shutdown" | "watchRun" | "watchClose" | "environment" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | undefined; + raw(): BuiltinPlugin; + apply(compiler: Compiler_2): void; + }; +}; + +// @public (undocumented) +export type SwcJsMinimizerRspackPluginOptions = { + passes?: number; + dropConsole?: boolean; + pureFuncs?: Array; + keepClassNames?: boolean; + keepFnNames?: boolean; + comments?: false | "all" | "some"; + asciiOnly?: boolean; + extractComments?: ExtractCommentsOptions | undefined; + compress?: TerserCompressOptions | boolean; + mangle?: TerserMangleOptions | boolean; + format?: JsFormatOptions & ToSnakeCaseProperties; + module?: boolean; + test?: MinifyConditions; + exclude?: MinifyConditions; + include?: MinifyConditions; +}; + +// Warning: (ae-forgotten-export) The symbol "target" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type Target = z.infer; + +// @public (undocumented) +export const Template: any; + +// Warning: (ae-forgotten-export) The symbol "trustedTypes" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type TrustedTypes = z.infer; + +// Warning: (ae-forgotten-export) The symbol "umdNamedDefine" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type UmdNamedDefine = z.infer; + +// Warning: (ae-forgotten-export) The symbol "uniqueName" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type UniqueName = z.infer; + +// @public (undocumented) +export const util: { + createHash: (algorithm: any) => any; + cleverMerge: (first: T, second: O) => T | O | (T & O); +}; + +// @public (undocumented) +export const version: any; + +// Warning: (ae-forgotten-export) The symbol "Wasm" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export const wasm: Wasm; + +// Warning: (ae-forgotten-export) The symbol "wasmLoading" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type WasmLoading = z.infer; + +// Warning: (ae-forgotten-export) The symbol "wasmLoadingType" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type WasmLoadingType = z.infer; + +// Warning: (ae-forgotten-export) The symbol "watch" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type Watch = z.infer; + +// @public (undocumented) +export class Watching { + constructor(compiler: Compiler, watchOptions: WatchOptions, handler: (error?: Error, stats?: Stats) => void); + // (undocumented) + blocked: boolean; + // (undocumented) + callbacks: Callback_2[]; + // (undocumented) + close(callback?: () => void): void; + // (undocumented) + compiler: Compiler; + // (undocumented) + handler: (error?: Error, stats?: Stats) => void; + // (undocumented) + invalid: boolean; + // (undocumented) + invalidate(callback?: Callback_2): void; + // (undocumented) + isBlocked?: () => boolean; + // (undocumented) + lastWatcherStartTime: number; + // (undocumented) + onChange?: () => void; + // (undocumented) + onInvalid?: () => void; + // (undocumented) + pausedWatcher?: Watcher; + // (undocumented) + resume(): void; + // (undocumented) + running: boolean; + // (undocumented) + startTime?: number; + // (undocumented) + suspend(): void; + // (undocumented) + suspended: boolean; + // (undocumented) + watch(files: Iterable, dirs: Iterable, missing: Iterable): void; + // Warning: (ae-forgotten-export) The symbol "Watcher" needs to be exported by the entry point index.d.ts + // + // (undocumented) + watcher?: Watcher; + // (undocumented) + watchOptions: WatchOptions; +} + +// Warning: (ae-forgotten-export) The symbol "watchOptions" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type WatchOptions = z.infer; + +// Warning: (ae-forgotten-export) The symbol "webassemblyModuleFilename" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type WebassemblyModuleFilename = z.infer; + +// @public (undocumented) +export const WebpackError: ErrorConstructor; + +// Warning: (ae-forgotten-export) The symbol "Webworker" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export const webworker: Webworker; + +// Warning: (ae-forgotten-export) The symbol "workerPublicPath" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type WorkerPublicPath = z.infer; + +// Warnings were encountered during analysis: +// +// dist/Compilation.d.ts:65:9 - (ae-forgotten-export) The symbol "liteTapable" needs to be exported by the entry point index.d.ts +// dist/Compilation.d.ts:70:9 - (ae-forgotten-export) The symbol "Module" needs to be exported by the entry point index.d.ts +// dist/Compilation.d.ts:72:9 - (ae-forgotten-export) The symbol "Chunk" needs to be exported by the entry point index.d.ts +// dist/Compilation.d.ts:85:9 - (ae-forgotten-export) The symbol "StatsFactory" needs to be exported by the entry point index.d.ts +// dist/Compilation.d.ts:86:9 - (ae-forgotten-export) The symbol "StatsPrinter" needs to be exported by the entry point index.d.ts +// dist/Compilation.d.ts:88:9 - (ae-forgotten-export) The symbol "ExecuteModuleArgument" needs to be exported by the entry point index.d.ts +// dist/Compilation.d.ts:88:9 - (ae-forgotten-export) The symbol "ExecuteModuleContext" needs to be exported by the entry point index.d.ts +// dist/Compiler.d.ts:82:9 - (ae-forgotten-export) The symbol "AssetEmittedInfo" needs to be exported by the entry point index.d.ts +// dist/MultiCompiler.d.ts:35:9 - (ae-forgotten-export) The symbol "Any" needs to be exported by the entry point index.d.ts +// dist/NormalModuleFactory.d.ts:9:9 - (ae-forgotten-export) The symbol "ResourceDataWithData" needs to be exported by the entry point index.d.ts +// dist/NormalModuleFactory.d.ts:10:9 - (ae-forgotten-export) The symbol "ResolveData" needs to be exported by the entry point index.d.ts +// dist/NormalModuleFactory.d.ts:12:9 - (ae-forgotten-export) The symbol "NormalModuleCreateData" needs to be exported by the entry point index.d.ts +// dist/builtin-plugin/SwcJsMinimizerPlugin.d.ts:40:5 - (ae-forgotten-export) The symbol "ExtractCommentsOptions" needs to be exported by the entry point index.d.ts +// dist/builtin-plugin/SwcJsMinimizerPlugin.d.ts:41:5 - (ae-forgotten-export) The symbol "TerserCompressOptions" needs to be exported by the entry point index.d.ts +// dist/builtin-plugin/SwcJsMinimizerPlugin.d.ts:42:5 - (ae-forgotten-export) The symbol "TerserMangleOptions" needs to be exported by the entry point index.d.ts +// dist/builtin-plugin/SwcJsMinimizerPlugin.d.ts:43:5 - (ae-forgotten-export) The symbol "JsFormatOptions" needs to be exported by the entry point index.d.ts +// dist/builtin-plugin/SwcJsMinimizerPlugin.d.ts:43:5 - (ae-forgotten-export) The symbol "ToSnakeCaseProperties" needs to be exported by the entry point index.d.ts +// dist/builtin-plugin/SwcJsMinimizerPlugin.d.ts:45:5 - (ae-forgotten-export) The symbol "MinifyConditions" needs to be exported by the entry point index.d.ts +// dist/config/adapterRuleUse.d.ts:145:5 - (ae-forgotten-export) The symbol "PitchLoaderDefinitionFunction" needs to be exported by the entry point index.d.ts +// dist/config/zod.d.ts:5264:5 - (ae-forgotten-export) The symbol "oldBuiltins" needs to be exported by the entry point index.d.ts +// dist/exports.d.ts:103:5 - (ae-forgotten-export) The symbol "ContainerPlugin" needs to be exported by the entry point index.d.ts +// dist/exports.d.ts:104:5 - (ae-forgotten-export) The symbol "ContainerReferencePlugin" needs to be exported by the entry point index.d.ts +// dist/exports.d.ts:105:5 - (ae-forgotten-export) The symbol "ModuleFederationPlugin" needs to be exported by the entry point index.d.ts +// dist/exports.d.ts:106:5 - (ae-forgotten-export) The symbol "ModuleFederationPluginV1" needs to be exported by the entry point index.d.ts +// dist/exports.d.ts:115:5 - (ae-forgotten-export) The symbol "ProvideSharedPlugin" needs to be exported by the entry point index.d.ts +// dist/exports.d.ts:116:5 - (ae-forgotten-export) The symbol "ConsumeSharedPlugin" needs to be exported by the entry point index.d.ts +// dist/exports.d.ts:117:5 - (ae-forgotten-export) The symbol "SharePlugin" needs to be exported by the entry point index.d.ts + +// (No @packageDocumentation comment for this package) + +``` diff --git a/packages/rspack/package.json b/packages/rspack/package.json index daf04a02b65..545d50c7434 100644 --- a/packages/rspack/package.json +++ b/packages/rspack/package.json @@ -17,7 +17,9 @@ "scripts": { "build": "tsc -b ./tsconfig.build.json", "dev": "tsc -w", - "test": "cross-env NO_COLOR=1 node --expose-gc --max-old-space-size=8192 --experimental-vm-modules ../../node_modules/jest-cli/bin/jest --logHeapUsage" + "test": "cross-env NO_COLOR=1 node --expose-gc --max-old-space-size=8192 --experimental-vm-modules ../../node_modules/jest-cli/bin/jest --logHeapUsage", + "api-extractor": "api-extractor run --verbose", + "api-extractor:ci": "api-extractor run --verbose || diff temp/core.api.md etc/core.api.md" }, "files": [ "dist", diff --git a/packages/rspack/src/Compilation.ts b/packages/rspack/src/Compilation.ts index bea464e016e..a347e07933c 100644 --- a/packages/rspack/src/Compilation.ts +++ b/packages/rspack/src/Compilation.ts @@ -33,7 +33,7 @@ import { } from "./config"; import * as liteTapable from "./lite-tapable"; import { ContextModuleFactory } from "./ContextModuleFactory"; -import ResolverFactory from "./ResolverFactory"; +import ResolverFactory = require("./ResolverFactory"); import { ChunkGroup } from "./ChunkGroup"; import { Compiler } from "./Compiler"; import ErrorHelpers from "./ErrorHelpers"; @@ -486,10 +486,9 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si * See: [Compilation.emitAsset](https://webpack.js.org/api/compilation-object/#emitasset) * Source: [emitAsset](https://github.com/webpack/webpack/blob/9fcaa243573005d6fdece9a3f8d89a0e8b399613/lib/Compilation.js#L4239) * - * @param {string} file file name - * @param {Source} source asset source - * @param {JsAssetInfo} assetInfo extra asset information - * @returns {void} + * @param file - file name + * @param source - asset source + * @param assetInfo - extra asset information */ emitAsset(filename: string, source: Source, assetInfo?: AssetInfo) { this.#inner.emitAsset( diff --git a/packages/rspack/src/Compiler.ts b/packages/rspack/src/Compiler.ts index aaf8e20fca6..d1f5ddb3666 100644 --- a/packages/rspack/src/Compiler.ts +++ b/packages/rspack/src/Compiler.ts @@ -25,11 +25,11 @@ import { RuleSetCompiler } from "./RuleSetCompiler"; import { Stats } from "./Stats"; import { Compilation, CompilationParams } from "./Compilation"; import { ContextModuleFactory } from "./ContextModuleFactory"; -import ResolverFactory from "./ResolverFactory"; +import ResolverFactory = require("./ResolverFactory"); import ConcurrentCompilationError from "./error/ConcurrentCompilationError"; import { createThreadsafeNodeFSFromRaw } from "./fileSystem"; -import Cache from "./lib/Cache"; -import CacheFacade from "./lib/CacheFacade"; +import Cache = require("./lib/Cache"); +import CacheFacade = require("./lib/CacheFacade"); import { Logger } from "./logging/Logger"; import { NormalModuleCreateData, @@ -200,8 +200,8 @@ class Compiler { } /** - * @param {string} name cache name - * @returns {CacheFacade} the cache facade instance + * @param name - cache name + * @returns the cache facade instance */ getCache(name: string): CacheFacade { return new CacheFacade( diff --git a/packages/rspack/src/MultiCompiler.ts b/packages/rspack/src/MultiCompiler.ts index 1e7677e8cef..e4545087273 100644 --- a/packages/rspack/src/MultiCompiler.ts +++ b/packages/rspack/src/MultiCompiler.ts @@ -9,7 +9,7 @@ */ import { Compiler, RspackOptions, Stats } from "."; -import ResolverFactory from "./ResolverFactory"; +import ResolverFactory = require("./ResolverFactory"); import { WatchFileSystem } from "./util/fs"; import { Watching } from "./Watching"; import { AsyncSeriesHook, Callback, MultiHook, SyncHook } from "tapable"; @@ -172,18 +172,12 @@ export class MultiCompiler { throw new Error("Cannot read outputFileSystem of a MultiCompiler"); } - /** - * @param {InputFileSystem} value the new input file system - */ set inputFileSystem(value) { for (const compiler of this.compilers) { compiler.inputFileSystem = value; } } - /** - * @param {OutputFileSystem} value the new output file system - */ set outputFileSystem(value: typeof import("fs")) { for (const compiler of this.compilers) { compiler.outputFileSystem = value; @@ -196,9 +190,6 @@ export class MultiCompiler { } } - /** - * @param {IntermediateFileSystem} value the new intermediate file system - */ set intermediateFileSystem(value: any) { for (const compiler of this.compilers) { compiler.intermediateFileSystem = value; @@ -210,17 +201,16 @@ export class MultiCompiler { } /** - * @param {Compiler} compiler the child compiler - * @param {string[]} dependencies its dependencies - * @returns {void} + * @param compiler - the child compiler + * @param dependencies - its dependencies */ setDependencies(compiler: Compiler, dependencies: string[]) { this.dependencies.set(compiler, dependencies); } /** - * @param {Callback} callback signals when the validation is complete - * @returns {boolean} true if the dependencies are valid + * @param callback - signals when the validation is complete + * @returns true if the dependencies are valid */ validateDependencies(callback: Callback): boolean { const edges = new Set<{ source: Compiler; target: Compiler }>(); @@ -492,9 +482,9 @@ export class MultiCompiler { } /** - * @param {WatchOptions|WatchOptions[]} watchOptions the watcher's options - * @param {Callback} handler signals when the call finishes - * @returns {MultiWatching} a compiler watcher + * @param watchOptions - the watcher's options + * @param handler - signals when the call finishes + * @returns a compiler watcher */ watch( watchOptions: WatchOptions, diff --git a/packages/rspack/src/MultiWatching.ts b/packages/rspack/src/MultiWatching.ts index 58517f262ce..baae12c50bd 100644 --- a/packages/rspack/src/MultiWatching.ts +++ b/packages/rspack/src/MultiWatching.ts @@ -12,23 +12,13 @@ import { MultiCompiler } from "./MultiCompiler"; import { Watching } from "./Watching"; import asyncLib from "neo-async"; -/** @typedef {import("./MultiCompiler")} MultiCompiler */ -/** @typedef {import("./Watching")} Watching */ - -/** - * @template T - * @callback Callback - * @param {(Error | null)=} err - * @param {T=} result - */ - class MultiWatching { watchings: Watching[]; compiler: MultiCompiler; /** - * @param {Watching[]} watchings child compilers' watchers - * @param {MultiCompiler} compiler the compiler + * @param watchings - child compilers' watchers + * @param compiler - the compiler */ constructor(watchings: Watching[], compiler: MultiCompiler) { this.watchings = watchings; diff --git a/packages/rspack/src/RuntimeGlobals.ts b/packages/rspack/src/RuntimeGlobals.ts index 61b4158af9b..5074e1e2c13 100644 --- a/packages/rspack/src/RuntimeGlobals.ts +++ b/packages/rspack/src/RuntimeGlobals.ts @@ -3,7 +3,7 @@ * https://github.com/webpack/webpack/blob/v5.88.2/lib/RuntimeGlobals.js * * MIT Licensed - * Author Tobias Koppers @sokra + * Author Tobias Koppers \@sokra * Copyright (c) JS Foundation and other contributors * https://github.com/webpack/webpack/blob/main/LICENSE */ @@ -165,7 +165,7 @@ export const RuntimeGlobals = { /** * function to load a script tag. - * Arguments: (url: string, done: (event) => void), key?: string | number, chunkId?: string | number) => void + * Arguments: (url: string, done: (event) =\> void), key?: string | number, chunkId?: string | number) =\> void * done function is called when loading has finished or timeout occurred. * It will attach to existing script tags with data-webpack == uniqueName + ":" + key or src == url. */ @@ -174,20 +174,20 @@ export const RuntimeGlobals = { /** * function to promote a string to a TrustedScript using webpack's Trusted * Types policy - * Arguments: (script: string) => TrustedScript + * Arguments: (script: string) =\> TrustedScript */ createScript: "__webpack_require__.ts", /** * function to promote a string to a TrustedScriptURL using webpack's Trusted * Types policy - * Arguments: (url: string) => TrustedScriptURL + * Arguments: (url: string) =\> TrustedScriptURL */ createScriptUrl: "__webpack_require__.tu", /** * function to return webpack's Trusted Types policy - * Arguments: () => TrustedTypePolicy + * Arguments: () =\> TrustedTypePolicy */ getTrustedTypesPolicy: "__webpack_require__.tt", @@ -260,7 +260,7 @@ export const RuntimeGlobals = { /** * method to startup an entrypoint with needed chunks. - * Signature: (moduleId: Id, chunkIds: Id[]) => any. + * Signature: (moduleId: Id, chunkIds: Id[]) =\> any. * Returns the exports of the module or a Promise */ startupEntrypoint: "__webpack_require__.X", @@ -268,7 +268,7 @@ export const RuntimeGlobals = { /** * register deferred code, which will run when certain * chunks are loaded. - * Signature: (chunkIds: Id[], fn: () => any, priority: int >= 0 = 0) => any + * Signature: (chunkIds: Id[], fn: () =\> any, priority: int \>= 0 = 0) =\> any * Returned value will be returned directly when all chunks are already loaded * When (priority & 1) it will wait for all other handlers with lower priority to * be executed before itself is executed @@ -277,7 +277,7 @@ export const RuntimeGlobals = { /** * method to install a chunk that was loaded somehow - * Signature: ({ id, ids, modules, runtime }) => void + * Signature: (\{ id, ids, modules, runtime \}) =\> void */ externalInstallChunk: "__webpack_require__.C", @@ -382,9 +382,9 @@ export const RuntimeGlobals = { * If "hasAwaitAfterDependencies" is truthy, "handleDependencies()" must be called at the end of the body function. * Signature: function( * module: Module, - * body: (handleDependencies: (deps: AsyncModulePromise[]) => Promise & () => void, + * body: (handleDependencies: (deps: AsyncModulePromise[]) =\> Promise\ & () =\> void, * hasAwaitAfterDependencies?: boolean - * ) => void + * ) =\> void */ asyncModule: "__webpack_require__.a" } as const; diff --git a/packages/rspack/src/builtin-plugin/SourceMapDevToolPlugin.ts b/packages/rspack/src/builtin-plugin/SourceMapDevToolPlugin.ts index ac59892d5b4..eb1e04401a5 100644 --- a/packages/rspack/src/builtin-plugin/SourceMapDevToolPlugin.ts +++ b/packages/rspack/src/builtin-plugin/SourceMapDevToolPlugin.ts @@ -2,7 +2,7 @@ import { BuiltinPluginName, RawSourceMapDevToolPluginOptions } from "@rspack/binding"; -import { matchObject } from "../ModuleFilenameHelpers"; +import { matchObject } from "../lib/ModuleFilenameHelpers"; import { create } from "./base"; /** diff --git a/packages/rspack/src/builtin-plugin/SwcJsMinimizerPlugin.ts b/packages/rspack/src/builtin-plugin/SwcJsMinimizerPlugin.ts index f1677d93791..35437cbb4c1 100644 --- a/packages/rspack/src/builtin-plugin/SwcJsMinimizerPlugin.ts +++ b/packages/rspack/src/builtin-plugin/SwcJsMinimizerPlugin.ts @@ -65,7 +65,7 @@ type ToSnakeCase = T extends `${infer A}${infer B}` ? `${A extends Lowercase ? A : `_${Lowercase}`}${ToSnakeCase}` : T; /** - * @example ToSnakeCaseProperties<{indentLevel: 3}> == {indent_level: 3} + * @example ToSnakeCaseProperties\<{indentLevel: 3\}\> == {indent_level: 3\} */ type ToSnakeCaseProperties = { [K in keyof T as K extends string ? ToSnakeCase : K]: T[K]; diff --git a/packages/rspack/src/config/adapterRuleUse.ts b/packages/rspack/src/config/adapterRuleUse.ts index fb89e04020b..bf443acaee7 100644 --- a/packages/rspack/src/config/adapterRuleUse.ts +++ b/packages/rspack/src/config/adapterRuleUse.ts @@ -8,7 +8,7 @@ import { ResolveRequest } from "enhanced-resolve"; import { Compiler } from "../Compiler"; import { Logger } from "../logging/Logger"; -import Hash from "../util/hash"; +import Hash = require("../util/hash"); import { Mode, Resolve, RuleSetUseItem, RuleSetLoaderWithOptions } from "./zod"; import { parsePathQueryFragment } from "../loader-runner"; import { isNil } from "../util"; diff --git a/packages/rspack/src/config/defaults.ts b/packages/rspack/src/config/defaults.ts index 907ce43481f..2be0ecc10a6 100644 --- a/packages/rspack/src/config/defaults.ts +++ b/packages/rspack/src/config/defaults.ts @@ -39,7 +39,7 @@ import { OutputNormalized, RspackOptionsNormalized } from "./normalization"; -import Template from "../Template"; +import Template = require("../Template"); import { assertNotNill } from "../util/assertNotNil"; import { ASSET_MODULE_TYPE } from "../ModuleTypeConstants"; import { SwcJsMinimizerRspackPlugin } from "../builtin-plugin/SwcJsMinimizerPlugin"; diff --git a/packages/rspack/src/config/normalization.ts b/packages/rspack/src/config/normalization.ts index 9d3a815bdab..dee00c8185b 100644 --- a/packages/rspack/src/config/normalization.ts +++ b/packages/rspack/src/config/normalization.ts @@ -8,7 +8,8 @@ * https://github.com/webpack/webpack/blob/main/LICENSE */ -import { Compilation } from ".."; +import assert from "assert"; +import type { Compilation } from "../Compilation"; import type { Context, Dependencies, @@ -24,7 +25,6 @@ import type { Name, OptimizationRuntimeChunk, Resolve, - RspackOptions, Target, SnapshotOptions, CacheOptions, @@ -78,7 +78,8 @@ import type { NoParseOption, DevtoolNamespace, DevtoolModuleFilenameTemplate, - DevtoolFallbackModuleFilenameTemplate + DevtoolFallbackModuleFilenameTemplate, + RspackOptions } from "./zod"; export const getNormalizedRspackOptions = ( diff --git a/packages/rspack/src/exports.ts b/packages/rspack/src/exports.ts index 0cb10bb295e..5e43790126c 100644 --- a/packages/rspack/src/exports.ts +++ b/packages/rspack/src/exports.ts @@ -38,9 +38,13 @@ export type { NormalModuleFactory } from "./NormalModuleFactory"; export { NormalModule } from "./NormalModule"; -export { default as ModuleFilenameHelpers } from "./lib/ModuleFilenameHelpers"; +// API extractor not working with some re-exports, see: https://github.com/microsoft/fluentui/issues/20694 +const ModuleFilenameHelpers = require("./lib/ModuleFilenameHelpers"); +export { ModuleFilenameHelpers }; -export { default as Template } from "./Template"; +// API extractor not working with some re-exports, see: https://github.com/microsoft/fluentui/issues/20694 +const Template = require("./Template"); +export { Template }; export const WebpackError = Error; @@ -53,7 +57,15 @@ import { getNormalizedRspackOptions, applyRspackOptionsDefaults } from "./config"; -export const config = { + +// Explicitly define this type to avoid type inference and type expansion. +type Config = { + getNormalizedRspackOptions: typeof getNormalizedRspackOptions; + applyRspackOptionsDefaults: typeof applyRspackOptionsDefaults; + getNormalizedWebpackOptions: typeof getNormalizedRspackOptions; + applyWebpackOptionsDefaults: typeof applyRspackOptionsDefaults; +}; +export const config: Config = { getNormalizedRspackOptions, applyRspackOptionsDefaults, getNormalizedWebpackOptions: getNormalizedRspackOptions, @@ -105,25 +117,47 @@ export { NormalModuleReplacementPlugin } from "./lib/NormalModuleReplacementPlug import NodeTemplatePlugin from "./node/NodeTemplatePlugin"; import { NodeTargetPlugin } from "./builtin-plugin"; -export const node = { NodeTargetPlugin, NodeTemplatePlugin }; +interface Node { + NodeTargetPlugin: typeof NodeTargetPlugin; + NodeTemplatePlugin: typeof NodeTemplatePlugin; +} +export const node: Node = { NodeTargetPlugin, NodeTemplatePlugin }; import { ElectronTargetPlugin } from "./builtin-plugin"; -export const electron = { ElectronTargetPlugin }; +interface Electron { + ElectronTargetPlugin: typeof ElectronTargetPlugin; +} +export const electron: Electron = { ElectronTargetPlugin }; import { EnableLibraryPlugin } from "./builtin-plugin"; -export const library = { EnableLibraryPlugin }; +interface Library { + EnableLibraryPlugin: typeof EnableLibraryPlugin; +} +export const library: Library = { EnableLibraryPlugin }; import { EnableWasmLoadingPlugin } from "./builtin-plugin"; -export const wasm = { EnableWasmLoadingPlugin }; +interface Wasm { + EnableWasmLoadingPlugin: typeof EnableWasmLoadingPlugin; +} +export const wasm: Wasm = { EnableWasmLoadingPlugin }; import { EnableChunkLoadingPlugin } from "./builtin-plugin"; -export const javascript = { EnableChunkLoadingPlugin }; +interface JavaScript { + EnableChunkLoadingPlugin: typeof EnableChunkLoadingPlugin; +} +export const javascript: JavaScript = { EnableChunkLoadingPlugin }; import { WebWorkerTemplatePlugin } from "./builtin-plugin"; -export const webworker = { WebWorkerTemplatePlugin }; +interface Webworker { + WebWorkerTemplatePlugin: typeof WebWorkerTemplatePlugin; +} +export const webworker: Webworker = { WebWorkerTemplatePlugin }; import { LimitChunkCountPlugin } from "./builtin-plugin"; -export const optimize = { LimitChunkCountPlugin }; +interface Optimize { + LimitChunkCountPlugin: typeof LimitChunkCountPlugin; +} +export const optimize: Optimize = { LimitChunkCountPlugin }; import { ModuleFederationPlugin } from "./container/ModuleFederationPlugin"; export type { ModuleFederationPluginOptions } from "./container/ModuleFederationPlugin"; diff --git a/packages/rspack/src/lib/ModuleFilenameHelpers.js b/packages/rspack/src/lib/ModuleFilenameHelpers.js deleted file mode 100644 index ef37fc51210..00000000000 --- a/packages/rspack/src/lib/ModuleFilenameHelpers.js +++ /dev/null @@ -1,56 +0,0 @@ -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - -"use strict"; - -// /** @typedef {import("./ChunkGraph")} ChunkGraph */ -// /** @typedef {import("./Module")} Module */ -// /** @typedef {import("./RequestShortener")} RequestShortener */ -// /** @typedef {typeof import("./util/Hash")} Hash */ -/** @typedef {any} ChunkGraph */ -/** @typedef {any} Module */ -/** @typedef {any} RequestShortener */ -/** @typedef {any} Hash */ - -const ModuleFilenameHelpers = exports; - -// @ts-expect-error -const asRegExp = test => { - if (typeof test === "string") { - test = new RegExp("^" + test.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&")); - } - return test; -}; - -// @ts-expect-error -ModuleFilenameHelpers.matchPart = (str, test) => { - if (!test) return true; - test = asRegExp(test); - if (Array.isArray(test)) { - return test.map(asRegExp).some(regExp => regExp.test(str)); - } else { - return test.test(str); - } -}; - -// @ts-expect-error -ModuleFilenameHelpers.matchObject = (obj, str) => { - if (obj.test) { - if (!ModuleFilenameHelpers.matchPart(str, obj.test)) { - return false; - } - } - if (obj.include) { - if (!ModuleFilenameHelpers.matchPart(str, obj.include)) { - return false; - } - } - if (obj.exclude) { - if (ModuleFilenameHelpers.matchPart(str, obj.exclude)) { - return false; - } - } - return true; -}; diff --git a/packages/rspack/src/ModuleFilenameHelpers.ts b/packages/rspack/src/lib/ModuleFilenameHelpers.ts similarity index 100% rename from packages/rspack/src/ModuleFilenameHelpers.ts rename to packages/rspack/src/lib/ModuleFilenameHelpers.ts diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4373f2301ba..3238d6dc136 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8,6 +8,9 @@ importers: .: devDependencies: + '@microsoft/api-extractor': + specifier: ^7.43.1 + version: 7.43.1(@types/node@20.12.7) '@rspack/cli': specifier: workspace:* version: link:packages/rspack-cli @@ -3204,6 +3207,50 @@ packages: react-is: 16.13.1 dev: false + /@microsoft/api-extractor-model@7.28.14(@types/node@20.12.7): + resolution: {integrity: sha512-Bery/c8A8SsKPSvA82cTTuy/+OcxZbLRmKhPkk91/AJOQzxZsShcrmHFAGeiEqSIrv1nPZ3tKq9kfMLdCHmsqg==} + dependencies: + '@microsoft/tsdoc': 0.14.2 + '@microsoft/tsdoc-config': 0.16.2 + '@rushstack/node-core-library': 4.1.0(@types/node@20.12.7) + transitivePeerDependencies: + - '@types/node' + dev: true + + /@microsoft/api-extractor@7.43.1(@types/node@20.12.7): + resolution: {integrity: sha512-ohg40SsvFFgzHFAtYq5wKJc8ZDyY46bphjtnSvhSSlXpPTG7GHwyyXkn48UZiUCBwr2WC7TRC1Jfwz7nreuiyQ==} + hasBin: true + dependencies: + '@microsoft/api-extractor-model': 7.28.14(@types/node@20.12.7) + '@microsoft/tsdoc': 0.14.2 + '@microsoft/tsdoc-config': 0.16.2 + '@rushstack/node-core-library': 4.1.0(@types/node@20.12.7) + '@rushstack/rig-package': 0.5.2 + '@rushstack/terminal': 0.10.1(@types/node@20.12.7) + '@rushstack/ts-command-line': 4.19.2(@types/node@20.12.7) + lodash: 4.17.21 + minimatch: 3.0.8 + resolve: 1.22.8 + semver: 7.5.4 + source-map: 0.6.1 + typescript: 5.4.2 + transitivePeerDependencies: + - '@types/node' + dev: true + + /@microsoft/tsdoc-config@0.16.2: + resolution: {integrity: sha512-OGiIzzoBLgWWR0UdRJX98oYO+XKGf7tiK4Zk6tQ/E4IJqGCe7dvkTvgDZV5cFJUzLGDOjeAXrnZoA6QkVySuxw==} + dependencies: + '@microsoft/tsdoc': 0.14.2 + ajv: 6.12.6 + jju: 1.4.0 + resolve: 1.19.0 + dev: true + + /@microsoft/tsdoc@0.14.2: + resolution: {integrity: sha512-9b8mPpKrfeGRuhFH5iO1iwCLeIIsV6+H1sRfxbkoGXIyQE2BTsPd9zqSqQJ+pv5sJ/hT5M1zvOFL02MnEezFug==} + dev: true + /@module-federation/runtime-tools@0.0.8: resolution: {integrity: sha512-tqx3wlVHnpWLk+vn22c0x9Nv1BqdZnoS6vdMb53IsVpbQIFP70nhhvymHUyFuPkoLzMFidS7GpG58DYT/4lvCw==} dependencies: @@ -4154,6 +4201,54 @@ packages: resolution: {integrity: sha512-j7P6Rgr3mmtdkeDGTe0E/aYyWEWVtc5yFXtHCRHs28/jptDEWfaVOc5T7cblqy1XKPPfCxJc/8DwQ5YgLOZOVQ==} dev: false + /@rushstack/node-core-library@4.1.0(@types/node@20.12.7): + resolution: {integrity: sha512-qz4JFBZJCf1YN5cAXa1dP6Mki/HrsQxc/oYGAGx29dF2cwF2YMxHoly0FBhMw3IEnxo5fMj0boVfoHVBkpkx/w==} + peerDependencies: + '@types/node': '*' + peerDependenciesMeta: + '@types/node': + optional: true + dependencies: + '@types/node': 20.12.7 + fs-extra: 7.0.1 + import-lazy: 4.0.0 + jju: 1.4.0 + resolve: 1.22.8 + semver: 7.5.4 + z-schema: 5.0.5 + dev: true + + /@rushstack/rig-package@0.5.2: + resolution: {integrity: sha512-mUDecIJeH3yYGZs2a48k+pbhM6JYwWlgjs2Ca5f2n1G2/kgdgP9D/07oglEGf6mRyXEnazhEENeYTSNDRCwdqA==} + dependencies: + resolve: 1.22.8 + strip-json-comments: 3.1.1 + dev: true + + /@rushstack/terminal@0.10.1(@types/node@20.12.7): + resolution: {integrity: sha512-C6Vi/m/84IYJTkfzmXr1+W8Wi3MmBjVF/q3za91Gb3VYjKbpALHVxY6FgH625AnDe5Z0Kh4MHKWA3Z7bqgAezA==} + peerDependencies: + '@types/node': '*' + peerDependenciesMeta: + '@types/node': + optional: true + dependencies: + '@rushstack/node-core-library': 4.1.0(@types/node@20.12.7) + '@types/node': 20.12.7 + supports-color: 8.1.1 + dev: true + + /@rushstack/ts-command-line@4.19.2(@types/node@20.12.7): + resolution: {integrity: sha512-cqmXXmBEBlzo9WtyUrHtF9e6kl0LvBY7aTSVX4jfnBfXWZQWnPq9JTFPlQZ+L/ZwjZ4HrNwQsOVvhe9oOucZkw==} + dependencies: + '@rushstack/terminal': 0.10.1(@types/node@20.12.7) + '@types/argparse': 1.0.38 + argparse: 1.0.10 + string-argv: 0.3.2 + transitivePeerDependencies: + - '@types/node' + dev: true + /@sinclair/typebox@0.27.8: resolution: {integrity: sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==} @@ -5545,6 +5640,10 @@ packages: d3-voronoi: 1.1.2 dev: false + /@types/argparse@1.0.38: + resolution: {integrity: sha512-ebDJ9b0e702Yr7pWgB0jzm+CX4Srzz8RcXtLJDJB+BSccqMa36uyH/zUsSYao5+BD1ytv3k3rPYCq4mAE1hsXA==} + dev: true + /@types/babel-types@7.0.15: resolution: {integrity: sha512-JUgfZHUOMbtjopxiOQaaF+Uovk5wpDqpXR+XLWiOivCWSy1FccO30lvNNpCt8geFwq8VmGT2y9OMkOpA0g5O5g==} dev: true @@ -7621,6 +7720,13 @@ packages: engines: {node: '>= 12'} dev: true + /commander@9.5.0: + resolution: {integrity: sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==} + engines: {node: ^12.20.0 || >=14} + requiresBuild: true + dev: true + optional: true + /common-path-prefix@3.0.0: resolution: {integrity: sha512-QE33hToZseCH3jS0qN96O/bSh3kaw/h+Tq7ngyY9eWDUnTlTNUyqfqvCXioLe5Na5jFsL78ra/wuBU4iuEgd4w==} dev: true @@ -9448,6 +9554,15 @@ packages: jsonfile: 6.1.0 universalify: 2.0.1 + /fs-extra@7.0.1: + resolution: {integrity: sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==} + engines: {node: '>=6 <7 || >=8'} + dependencies: + graceful-fs: 4.2.10 + jsonfile: 4.0.0 + universalify: 0.1.2 + dev: true + /fs-monkey@1.0.5: resolution: {integrity: sha512-8uMbBjrhzW76TYgEV27Y5E//W2f/lTFmx78P2w19FZSxarhI/798APGQyuGCwmkNxgwGRhrLfvWyLBvNtuOmew==} @@ -10138,6 +10253,11 @@ packages: engines: {node: '>=4'} dev: true + /import-lazy@4.0.0: + resolution: {integrity: sha512-rKtvo6a868b5Hu3heneU+L4yEQ4jYKLtjpnPeUdK7h0yzXGmyBTypknlkCvHFBqfX9YlorEiMM6Dnq/5atfHkw==} + engines: {node: '>=8'} + dev: true + /import-local@3.1.0: resolution: {integrity: sha512-ASB07uLtnDs1o6EHjKpX34BKYDSqnFerfTOJL2HvMqF70LnxpjkzDB8J44oT9pu4AMPkQwf8jl6szgvNd2tRIg==} engines: {node: '>=8'} @@ -11106,6 +11226,10 @@ packages: hasBin: true dev: true + /jju@1.4.0: + resolution: {integrity: sha512-8wb9Yw966OSxApiCt0K3yNJL8pnNeIv+OEq2YMidz4FKP6nonSRoOXc80iXY4JaN2FC11B9qsNmDsm+ZOfMROA==} + dev: true + /js-stringify@1.0.2: resolution: {integrity: sha512-rtS5ATOo2Q5k1G+DADISilDA6lv79zIiwFd6CcjuIxGKLFm5C+RLImRscVap9k55i+MOZwgliw+NejvkLuGD5g==} dev: true @@ -11263,6 +11387,12 @@ packages: resolution: {integrity: sha512-AilxAyFOAcK5wA1+LeaySVBrHsGQvUFCDWXKpZjzaL0PqW+xfBOttn8GNtWKFWqneyMZj41MWF9Kl6iPWLwgOA==} dev: true + /jsonfile@4.0.0: + resolution: {integrity: sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==} + optionalDependencies: + graceful-fs: 4.2.10 + dev: true + /jsonfile@6.1.0: resolution: {integrity: sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==} dependencies: @@ -11545,6 +11675,14 @@ packages: /lodash.debounce@4.0.8: resolution: {integrity: sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow==} + /lodash.get@4.4.2: + resolution: {integrity: sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ==} + dev: true + + /lodash.isequal@4.5.0: + resolution: {integrity: sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ==} + dev: true + /lodash.iserror@3.1.1: resolution: {integrity: sha512-eT/VeNns9hS7vAj1NKW/rRX6b+C3UX3/IAAqEE7aC4Oo2C0iD82NaP5IS4bSlQsammTii4qBJ8G1zd1LTL8hCw==} @@ -11838,6 +11976,12 @@ packages: resolution: {integrity: sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg==} dev: true + /minimatch@3.0.8: + resolution: {integrity: sha512-6FsRAQsxQ61mw+qP1ZzbL9Bc78x2p5OqNgNpnoAFLTrX8n5Kxph0CsnhmKKNXTWjXqU5L0pGPR7hYk+XWZr60Q==} + dependencies: + brace-expansion: 1.1.11 + dev: true + /minimatch@3.1.2: resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==} dependencies: @@ -13804,6 +13948,13 @@ packages: resolution: {integrity: sha512-X2UW6Nw3n/aMgDVy+0rSqgHlv39WZAlZrXCdnbyEiKm17DSqHX4MmQMaST3FbeWR5FTuRcUwYAziZajji0Y7mg==} engines: {node: '>=10'} + /resolve@1.19.0: + resolution: {integrity: sha512-rArEXAgsBG4UgRGcynxWIWKFvh/XZCcS8UJdHhwy91zwAvCZIbcs+vAbflgBnNjYMs/i/i+/Ux6IZhML1yPvxg==} + dependencies: + is-core-module: 2.13.1 + path-parse: 1.0.7 + dev: true + /resolve@1.22.8: resolution: {integrity: sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==} hasBin: true @@ -14099,6 +14250,14 @@ packages: resolution: {integrity: sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==} hasBin: true + /semver@7.5.4: + resolution: {integrity: sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==} + engines: {node: '>=10'} + hasBin: true + dependencies: + lru-cache: 6.0.0 + dev: true + /semver@7.6.0: resolution: {integrity: sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==} engines: {node: '>=10'} @@ -15381,6 +15540,12 @@ packages: hasBin: true dev: true + /typescript@5.4.2: + resolution: {integrity: sha512-+2/g0Fds1ERlP6JsakQQDXjZdZMM+rqpamFZJEKh4kwTIn3iDkgKtby0CeNd5ATNZ4Ry1ax15TMx0W2V+miizQ==} + engines: {node: '>=14.17'} + hasBin: true + dev: true + /ua-parser-js@1.0.37: resolution: {integrity: sha512-bhTyI94tZofjo+Dn8SN6Zv8nBDvyXTymAdM3LDI/0IboIUwTu1rEhW7v2TfiVsoYWgkQ4kOVqnI8APUFbIQIFQ==} dev: true @@ -15480,6 +15645,11 @@ packages: resolution: {integrity: sha512-yCzhz6FN2wU1NiiQRogkTQszlQSlpWaw8SvVegAc+bDxbzHgh1vX8uIe8OYyMH6DwH+sdTJsgMl36+mSMdRJIQ==} dev: true + /universalify@0.1.2: + resolution: {integrity: sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==} + engines: {node: '>= 4.0.0'} + dev: true + /universalify@0.2.0: resolution: {integrity: sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==} engines: {node: '>= 4.0.0'} @@ -15683,6 +15853,11 @@ packages: spdx-expression-parse: 3.0.1 dev: true + /validator@13.11.0: + resolution: {integrity: sha512-Ii+sehpSfZy+At5nPdnyMhx78fEoPDkR2XW/zimHEL3MyGJQOCQ7WeP20jPYRz7ZCpcKLB21NxuXHF3bxjStBQ==} + engines: {node: '>= 0.10'} + dev: true + /value-equal@1.0.1: resolution: {integrity: sha512-NOJ6JZCAWr0zlxZt+xqCHNTEKOsrks2HQd4MqhP1qy4z1SkbEP467eNx6TgDKXMvUOb+OENfJCZwM+16n7fRfw==} dev: false @@ -16419,6 +16594,18 @@ packages: engines: {node: '>=12.20'} dev: true + /z-schema@5.0.5: + resolution: {integrity: sha512-D7eujBWkLa3p2sIpJA0d1pr7es+a7m0vFAnZLlCEKq/Ij2k0MLi9Br2UPxoxdYystm5K1yeBGzub0FlYUEWj2Q==} + engines: {node: '>=8.0.0'} + hasBin: true + dependencies: + lodash.get: 4.4.2 + lodash.isequal: 4.5.0 + validator: 13.11.0 + optionalDependencies: + commander: 9.5.0 + dev: true + /zod-validation-error@1.3.1(zod@3.22.4): resolution: {integrity: sha512-cNEXpla+tREtNdAnNKY4xKY1SGOn2yzyuZMu4O0RQylX9apRpUjNcPkEc3uHIAr5Ct7LenjZt6RzjEH6+JsqVQ==} engines: {node: '>=16.0.0'} From 5c198605b93c540f7c20a9051c1d20b87a103719 Mon Sep 17 00:00:00 2001 From: Hana Date: Tue, 16 Apr 2024 16:02:22 +0800 Subject: [PATCH 02/15] chore: update api snapshot (#6251) * chore: update api snapshot * chore: add lint --- api-extractor.json | 2 +- lint-staged.config.mjs | 13 ++++--- .../etc/{dev-server.api.md => api.md} | 0 packages/rspack-dev-server/package.json | 2 +- .../{plugin-react-refresh.api.md => api.md} | 0 .../rspack-plugin-react-refresh/package.json | 2 +- .../etc/{test-tools.api.md => api.md} | 34 +++++++++++++++++-- packages/rspack-test-tools/package.json | 2 +- packages/rspack/etc/{core.api.md => api.md} | 0 packages/rspack/package.json | 2 +- 10 files changed, 45 insertions(+), 12 deletions(-) rename packages/rspack-dev-server/etc/{dev-server.api.md => api.md} (100%) rename packages/rspack-plugin-react-refresh/etc/{plugin-react-refresh.api.md => api.md} (100%) rename packages/rspack-test-tools/etc/{test-tools.api.md => api.md} (96%) rename packages/rspack/etc/{core.api.md => api.md} (100%) diff --git a/api-extractor.json b/api-extractor.json index d92f4e1be64..c9dc7786375 100644 --- a/api-extractor.json +++ b/api-extractor.json @@ -152,7 +152,7 @@ * SUPPORTED TOKENS: , * DEFAULT VALUE: ".api.md" */ - // "reportFileName": ".api.md", + "reportFileName": "api.md", /** * Specifies the folder where the API report file is written. The file name portion is determined by diff --git a/lint-staged.config.mjs b/lint-staged.config.mjs index 876472e8fca..917f1beb2ed 100644 --- a/lint-staged.config.mjs +++ b/lint-staged.config.mjs @@ -1,6 +1,9 @@ export default { - "*.rs": "rustfmt --edition 2021", - "*.{ts,js}": "pnpm run format:js", - "*.toml": "npx @taplo/cli format", - "*.{ts,js,mjs}": () => "pnpm run lint:js" -} + "*.rs": "rustfmt --edition 2021", + "*.{ts,js}": "pnpm run format:js", + "*.toml": "npx @taplo/cli format", + "*.{ts,js,cts,cjs,mts,mjs}": () => [ + "pnpm run lint:js", + "pnpm run api-extractor:ci" + ] +}; diff --git a/packages/rspack-dev-server/etc/dev-server.api.md b/packages/rspack-dev-server/etc/api.md similarity index 100% rename from packages/rspack-dev-server/etc/dev-server.api.md rename to packages/rspack-dev-server/etc/api.md diff --git a/packages/rspack-dev-server/package.json b/packages/rspack-dev-server/package.json index 97da4b8f670..7869711f7a3 100644 --- a/packages/rspack-dev-server/package.json +++ b/packages/rspack-dev-server/package.json @@ -18,7 +18,7 @@ "dev": "tsc -w -b ./tsconfig.build.json", "test": "rimraf .test-temp && jest --runInBand", "api-extractor": "api-extractor run --verbose", - "api-extractor:ci": "api-extractor run --verbose || diff temp/core.api.md etc/core.api.md" + "api-extractor:ci": "api-extractor run --verbose || diff temp/api.md etc/api.md" }, "files": [ "dist", diff --git a/packages/rspack-plugin-react-refresh/etc/plugin-react-refresh.api.md b/packages/rspack-plugin-react-refresh/etc/api.md similarity index 100% rename from packages/rspack-plugin-react-refresh/etc/plugin-react-refresh.api.md rename to packages/rspack-plugin-react-refresh/etc/api.md diff --git a/packages/rspack-plugin-react-refresh/package.json b/packages/rspack-plugin-react-refresh/package.json index 747c663d1ba..c50c204d0e7 100644 --- a/packages/rspack-plugin-react-refresh/package.json +++ b/packages/rspack-plugin-react-refresh/package.json @@ -18,7 +18,7 @@ "dev": "tsc -b -w", "test": "jest --runInBand", "api-extractor": "api-extractor run --verbose", - "api-extractor:ci": "api-extractor run --verbose || diff temp/core.api.md etc/core.api.md" + "api-extractor:ci": "api-extractor run --verbose || diff temp/api.md etc/api.md" }, "files": [ "client", diff --git a/packages/rspack-test-tools/etc/test-tools.api.md b/packages/rspack-test-tools/etc/api.md similarity index 96% rename from packages/rspack-test-tools/etc/test-tools.api.md rename to packages/rspack-test-tools/etc/api.md index 34050435069..5fecd25ea71 100644 --- a/packages/rspack-test-tools/etc/test-tools.api.md +++ b/packages/rspack-test-tools/etc/api.md @@ -17,6 +17,7 @@ import { RspackOptionsNormalized } from '@rspack/core'; import { RspackPluginInstance } from '@rspack/core'; import { Stats } from '@rspack/core'; import type { Stats as Stats_2 } from 'webpack'; +import { StatsCompilation } from '@rspack/core'; import { WebpackOptionsNormalized } from 'webpack'; // @public (undocumented) @@ -91,6 +92,9 @@ export function createHashCase(name: string, src: string, dist: string): void; // @public (undocumented) export function createHotCase(name: string, src: string, dist: string, target: TCompilerOptions["target"]): void; +// @public (undocumented) +export function createHotStepCase(name: string, src: string, dist: string, target: TCompilerOptions["target"]): void; + // @public (undocumented) export function createNormalCase(name: string, src: string, dist: string): void; @@ -225,6 +229,12 @@ export class HotRunnerFactory extends BasicRunnerFactor protected createRunner(file: string, compilerOptions: TCompilerOptions, env: ITestEnv): ITestRunner; } +// @public (undocumented) +export class HotStepRunnerFactory extends HotRunnerFactory { + // (undocumented) + protected createRunner(file: string, compilerOptions: TCompilerOptions, env: ITestEnv): ITestRunner; +} + // @public (undocumented) export interface IBasicGlobalContext { // (undocumented) @@ -461,6 +471,10 @@ export interface IRspackHotProcessorOptions { target: TCompilerOptions["target"]; } +// @public (undocumented) +export interface IRspackHotStepProcessorOptions extends IRspackHotProcessorOptions { +} + // @public (undocumented) export interface IRspackStatsProcessorOptions { // (undocumented) @@ -816,12 +830,23 @@ export class RspackHotProcessor extends BasicTaskProcessor run(env: ITestEnv, context: ITestContext): Promise; // (undocumented) protected runner: ITestRunner | null; - // Warning: (ae-forgotten-export) The symbol "TUpdateOptions" needs to be exported by the entry point index.d.ts - // // (undocumented) protected updateOptions: TUpdateOptions; } +// @public (undocumented) +export class RspackHotStepProcessor extends RspackHotProcessor { + constructor(_hotOptions: IRspackHotProcessorOptions); + // (undocumented) + check(env: ITestEnv, context: ITestContext): Promise; + // (undocumented) + protected _hotOptions: IRspackHotProcessorOptions; + // (undocumented) + protected matchStepSnapshot(context: ITestContext, step: number, stats: StatsCompilation): void; + // (undocumented) + run(env: ITestEnv, context: ITestContext): Promise; +} + // @public (undocumented) export class RspackStatsProcessor extends MultiTaskProcessor { constructor(options: IRspackStatsProcessorOptions); @@ -1103,6 +1128,11 @@ export type TTestFilter = (creatorConfig: Record; +// @public (undocumented) +export type TUpdateOptions = { + updateIndex: number; +}; + // @public (undocumented) export class WatchRunnerFactory extends BasicRunnerFactory { // (undocumented) diff --git a/packages/rspack-test-tools/package.json b/packages/rspack-test-tools/package.json index e7b3be781f6..66e16ed0b7b 100644 --- a/packages/rspack-test-tools/package.json +++ b/packages/rspack-test-tools/package.json @@ -20,7 +20,7 @@ "test:ng": "cross-env SNAPSHOT=legacy NO_COLOR=1 node --expose-gc --max-old-space-size=8192 --experimental-vm-modules ../../node_modules/jest-cli/bin/jest --logHeapUsage --config ./jest.config.legacy.js", "test:diff": "cross-env RSPACK_DIFF=true NO_COLOR=1 node --expose-gc --max-old-space-size=8192 --experimental-vm-modules ../../node_modules/jest-cli/bin/jest --logHeapUsage --config ./jest.config.diff.js", "api-extractor": "api-extractor run --verbose", - "api-extractor:ci": "api-extractor run --verbose || diff temp/core.api.md etc/core.api.md" + "api-extractor:ci": "api-extractor run --verbose || diff temp/api.md etc/api.md" }, "files": [ "client", diff --git a/packages/rspack/etc/core.api.md b/packages/rspack/etc/api.md similarity index 100% rename from packages/rspack/etc/core.api.md rename to packages/rspack/etc/api.md diff --git a/packages/rspack/package.json b/packages/rspack/package.json index 545d50c7434..554e1801e32 100644 --- a/packages/rspack/package.json +++ b/packages/rspack/package.json @@ -19,7 +19,7 @@ "dev": "tsc -w", "test": "cross-env NO_COLOR=1 node --expose-gc --max-old-space-size=8192 --experimental-vm-modules ../../node_modules/jest-cli/bin/jest --logHeapUsage", "api-extractor": "api-extractor run --verbose", - "api-extractor:ci": "api-extractor run --verbose || diff temp/core.api.md etc/core.api.md" + "api-extractor:ci": "api-extractor run --verbose || diff temp/api.md etc/api.md" }, "files": [ "dist", From d4e493e92de57e6f5a5048e5c8aef65851fa18c5 Mon Sep 17 00:00:00 2001 From: Fy <1114550440@qq.com> Date: Tue, 16 Apr 2024 16:26:23 +0800 Subject: [PATCH 03/15] fix: dependencies span should rely on final ast (#6252) --- .../src/parser_and_generator/mod.rs | 52 ++++++++++--------- .../ConfigTestCases.basictest.js.snap | 13 +++++ .../configCases/css/export-selector/index.js | 8 +++ .../css/export-selector/style.module.css | 9 +--- .../css/export-selector/webpack.config.js | 3 +- 5 files changed, 53 insertions(+), 32 deletions(-) diff --git a/crates/rspack_plugin_css/src/parser_and_generator/mod.rs b/crates/rspack_plugin_css/src/parser_and_generator/mod.rs index 9eaff46c33c..bd6a65c527f 100644 --- a/crates/rspack_plugin_css/src/parser_and_generator/mod.rs +++ b/crates/rspack_plugin_css/src/parser_and_generator/mod.rs @@ -127,7 +127,7 @@ impl ParserAndGenerator for CssParserAndGenerator { let mut exports_pairs = vec![]; let mut presentational_dependencies = None; - if is_enable_css_modules { + let mut exports = if is_enable_css_modules { let mut stylesheet = swc_compiler.parse_file( &resource_path.to_string_lossy(), source_code.clone(), @@ -138,11 +138,6 @@ impl ParserAndGenerator for CssParserAndGenerator { }, )?; - let mut exports_analyzer = ExportsAnalyzer::new(&source_code); - stylesheet.visit_with(&mut exports_analyzer); - - presentational_dependencies = Some(exports_analyzer.presentation_deps); - let result = swc_core::css::modules::compile( &mut stylesheet, ModulesTransformConfig::new( @@ -154,7 +149,33 @@ impl ParserAndGenerator for CssParserAndGenerator { compiler_options, ), ); - let mut exports: IndexMap = result.renamed.into_iter().collect(); + let exports: IndexMap = result.renamed.into_iter().collect(); + + let (code, map) = swc_compiler.codegen( + &stylesheet, + SwcCssSourceMapGenConfig { + enable: !matches!(module_source_map_kind, SourceMapKind::None), + inline_sources_content: false, + emit_columns: matches!(module_source_map_kind, SourceMapKind::SourceMap), + }, + )?; + source_code = code; + source_map = map; + Some(exports) + } else { + None + }; + + let new_stylesheet_ast = SwcCssCompiler::default().parse_file( + &parse_context.resource_data.resource_path.to_string_lossy(), + source_code.clone(), + Default::default(), + )?; + + if let Some(exports) = &mut exports { + let mut exports_analyzer = ExportsAnalyzer::new(&source_code); + new_stylesheet_ast.visit_with(&mut exports_analyzer); + presentational_dependencies = Some(exports_analyzer.presentation_deps); for (key, value) in exports_analyzer.exports { exports.insert(key, vec![value]); @@ -180,25 +201,8 @@ impl ParserAndGenerator for CssParserAndGenerator { } self.exports = Some(normalized_exports); - - let (code, map) = swc_compiler.codegen( - &stylesheet, - SwcCssSourceMapGenConfig { - enable: !matches!(module_source_map_kind, SourceMapKind::None), - inline_sources_content: false, - emit_columns: matches!(module_source_map_kind, SourceMapKind::SourceMap), - }, - )?; - source_code = code; - source_map = map; } - let new_stylesheet_ast = SwcCssCompiler::default().parse_file( - &parse_context.resource_data.resource_path.to_string_lossy(), - source_code.clone(), - Default::default(), - )?; - let mut dependencies = analyze_dependencies( &new_stylesheet_ast, code_generation_dependencies, diff --git a/packages/rspack/tests/__snapshots__/ConfigTestCases.basictest.js.snap b/packages/rspack/tests/__snapshots__/ConfigTestCases.basictest.js.snap index 4497e064498..47f1a966f9a 100644 --- a/packages/rspack/tests/__snapshots__/ConfigTestCases.basictest.js.snap +++ b/packages/rspack/tests/__snapshots__/ConfigTestCases.basictest.js.snap @@ -232,6 +232,19 @@ exports[`ConfigTestCases css at-import-in-the-top exported tests at-import-in-th " `; +exports[`ConfigTestCases css export-selector exported tests should have correct css result 1`] = ` +"/* #region \\"./style.module.css?imported\\" */ +/* +- type: css/auto +*/ + +.local {} + +/* #endregion \\"./style.module.css?imported\\" */ + +" +`; + exports[`ConfigTestCases css rewrite-url exported tests should rewrite the css url() 1`] = `"eb587e4780c414fe3a22.png"`; exports[`ConfigTestCases css rewrite-url exported tests should rewrite the css url() 2`] = `"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAOCAYAAAAbvf3sAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAEWSURBVHgBjZFRSsNAEIb/3fQAOUK9gfpe6YIovjU3UE+gJ2g8gTcw3sC+itUFrW+BeAN7ATFSKAjbHWcSC+mSlszLDrvfzvzzj0LHmNpZBtBQd4Gf7fuYgHPPueoCe1DK1UsHd7Dzw+P0daQj/SC5h09OzdGktw221vZXUBlVMN0ILPd6O9yzBBXX8CBdv6kWOGa4YLivQJNjM0ia73oTLsBwJjCB5gu4i7CgbsIey5ThEcOfKziTGFOGHypJeZ7jZ/Gbst4x2/fN9h2eGTNvgk92VrDEWLNmfJXLpIYrRy5b4Fs+9v2/pL0oUncI7FuHLI6PK5lJZGoe8qXNvrry27DesoRLpLPmNkTw9yEcxPWJMR+S/AFbfpAZqxwUNQAAAABJRU5ErkJggg=="`; diff --git a/packages/rspack/tests/configCases/css/export-selector/index.js b/packages/rspack/tests/configCases/css/export-selector/index.js index 45d7f7121ef..105077c5ef1 100644 --- a/packages/rspack/tests/configCases/css/export-selector/index.js +++ b/packages/rspack/tests/configCases/css/export-selector/index.js @@ -1,3 +1,11 @@ +const fs = require('fs') +const path = require('path') + +it('should have correct css result', async () => { + const css = await fs.promises.readFile(path.resolve(__dirname, './imported_js.bundle0.css')) + expect(css.toString()).toMatchSnapshot() +}) + it("should allow to dynamic import a css module", done => { import("./style.module.css").then(x => { try { diff --git a/packages/rspack/tests/configCases/css/export-selector/style.module.css b/packages/rspack/tests/configCases/css/export-selector/style.module.css index 79e5fd62c92..a1c3841b03f 100644 --- a/packages/rspack/tests/configCases/css/export-selector/style.module.css +++ b/packages/rspack/tests/configCases/css/export-selector/style.module.css @@ -1,11 +1,6 @@ -:export { - foo: foo; - bar: b a r; -} +:export {foo:foo;bar:b a r} .local {} -:export { - dash-name: dashName; -} +:export {dash-name:dashName} diff --git a/packages/rspack/tests/configCases/css/export-selector/webpack.config.js b/packages/rspack/tests/configCases/css/export-selector/webpack.config.js index cf967f7bc72..f01113fe0dc 100644 --- a/packages/rspack/tests/configCases/css/export-selector/webpack.config.js +++ b/packages/rspack/tests/configCases/css/export-selector/webpack.config.js @@ -4,7 +4,8 @@ module.exports = { generator: { 'css/auto': { exportsConvention: 'camel-case-only', - localIdentName: '[local]' + localIdentName: '[local]', + exportsOnly: false } } }, From dd357939d1170a2154c7ad9b257a2c321afc875e Mon Sep 17 00:00:00 2001 From: Gengkun Date: Tue, 16 Apr 2024 17:04:13 +0800 Subject: [PATCH 04/15] fix: json empty array panic (#6253) --- crates/rspack_plugin_json/src/lib.rs | 2 +- .../tree-shaking/json-empty-array/arr.json | 1 + .../tree-shaking/json-empty-array/index.js | 5 +++++ .../json-empty-array/webpack.config.js | 15 +++++++++++++++ 4 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 packages/rspack/tests/configCases/tree-shaking/json-empty-array/arr.json create mode 100644 packages/rspack/tests/configCases/tree-shaking/json-empty-array/index.js create mode 100644 packages/rspack/tests/configCases/tree-shaking/json-empty-array/webpack.config.js diff --git a/crates/rspack_plugin_json/src/lib.rs b/crates/rspack_plugin_json/src/lib.rs index 43a138adaa2..b086163b3e6 100644 --- a/crates/rspack_plugin_json/src/lib.rs +++ b/crates/rspack_plugin_json/src/lib.rs @@ -312,7 +312,7 @@ fn create_object_for_exports_info( let used_length = if let Some(array_length_when_used) = array_length_when_used { array_length_when_used } else { - max_used_index + 1 + (max_used_index + 1).min(ret.len()) }; ret.drain(used_length..); let normalized_ret = ret diff --git a/packages/rspack/tests/configCases/tree-shaking/json-empty-array/arr.json b/packages/rspack/tests/configCases/tree-shaking/json-empty-array/arr.json new file mode 100644 index 00000000000..fe51488c706 --- /dev/null +++ b/packages/rspack/tests/configCases/tree-shaking/json-empty-array/arr.json @@ -0,0 +1 @@ +[] diff --git a/packages/rspack/tests/configCases/tree-shaking/json-empty-array/index.js b/packages/rspack/tests/configCases/tree-shaking/json-empty-array/index.js new file mode 100644 index 00000000000..53c06760a36 --- /dev/null +++ b/packages/rspack/tests/configCases/tree-shaking/json-empty-array/index.js @@ -0,0 +1,5 @@ +import arr from "./arr.json" + +it("should not panic and have correct value", () => { + expect(arr[0]).toBe(undefined) +}) diff --git a/packages/rspack/tests/configCases/tree-shaking/json-empty-array/webpack.config.js b/packages/rspack/tests/configCases/tree-shaking/json-empty-array/webpack.config.js new file mode 100644 index 00000000000..f2d0e8903b9 --- /dev/null +++ b/packages/rspack/tests/configCases/tree-shaking/json-empty-array/webpack.config.js @@ -0,0 +1,15 @@ +/**@type {import('@rspack/cli').Configuration}*/ +module.exports = { + context: __dirname, + experiments: { + rspackFuture: { + newTreeshaking: true + } + }, + optimization: { + innerGraph: true, + sideEffects: true, + usedExports: true, + providedExports: true + } +}; From d47c28109367940904653f0ce0fabbfb40052022 Mon Sep 17 00:00:00 2001 From: Gengkun Date: Tue, 16 Apr 2024 17:17:51 +0800 Subject: [PATCH 05/15] fix: napi value convert error in css-loader (#6250) --- crates/node_binding/binding.d.ts | 30 +++++----- .../rspack_binding_values/src/compilation.rs | 10 ++-- crates/rspack_binding_values/src/filename.rs | 8 +-- crates/rspack_binding_values/src/path_data.rs | 20 +++---- packages/rspack/etc/api.md | 58 ++++++++++--------- packages/rspack/src/Compilation.ts | 5 +- packages/rspack/src/config/zod.ts | 3 +- .../index.js | 0 .../test.config.js | 3 + .../webpack.config.js | 28 +++++++++ 10 files changed, 101 insertions(+), 64 deletions(-) create mode 100644 packages/rspack/tests/configCases/hooks/compat-path-data-chunk-contenthash/index.js create mode 100644 packages/rspack/tests/configCases/hooks/compat-path-data-chunk-contenthash/test.config.js create mode 100644 packages/rspack/tests/configCases/hooks/compat-path-data-chunk-contenthash/webpack.config.js diff --git a/crates/node_binding/binding.d.ts b/crates/node_binding/binding.d.ts index 28fdf1f090e..8f34345a830 100644 --- a/crates/node_binding/binding.d.ts +++ b/crates/node_binding/binding.d.ts @@ -33,10 +33,10 @@ export class JsCompilation { pushDiagnostic(severity: "error" | "warning", title: string, message: string): void pushNativeDiagnostics(diagnostics: ExternalObject<'Diagnostic[]'>): void getStats(): JsStats - getAssetPath(filename: string | ((pathData: PathData, assetInfo?: JsAssetInfo) => string), data: PathData): string - getAssetPathWithInfo(filename: string | ((pathData: PathData, assetInfo?: JsAssetInfo) => string), data: PathData): PathWithInfo - getPath(filename: string | ((pathData: PathData, assetInfo?: JsAssetInfo) => string), data: PathData): string - getPathWithInfo(filename: string | ((pathData: PathData, assetInfo?: JsAssetInfo) => string), data: PathData): PathWithInfo + getAssetPath(filename: string | ((pathData: PathData, assetInfo?: JsAssetInfo) => string), data: JsPathData): string + getAssetPathWithInfo(filename: string | ((pathData: PathData, assetInfo?: JsAssetInfo) => string), data: JsPathData): PathWithInfo + getPath(filename: string | ((pathData: PathData, assetInfo?: JsAssetInfo) => string), data: JsPathData): string + getPathWithInfo(filename: string | ((pathData: PathData, assetInfo?: JsAssetInfo) => string), data: JsPathData): PathWithInfo addFileDependencies(deps: Array): void addContextDependencies(deps: Array): void addMissingDependencies(deps: Array): void @@ -260,7 +260,7 @@ export interface JsChunkPathData { id?: string name?: string hash?: string - contentHash?: Record + contentHash?: string | Record } export interface JsCodegenerationResult { @@ -380,6 +380,16 @@ export interface JsNormalModuleFactoryCreateModuleArgs { matchResource?: string } +export interface JsPathData { + filename?: string + hash?: string + contentHash?: string + runtime?: string + url?: string + id?: string + chunk?: JsChunkPathData +} + export interface JsResolveForSchemeArgs { resourceData: JsResourceData scheme: string @@ -549,16 +559,6 @@ export interface NodeFS { mkdirp: (...args: any[]) => any } -export interface PathData { - filename?: string - hash?: string - contentHash?: string - runtime?: string - url?: string - id?: string - chunk?: JsChunkPathData -} - export interface PathWithInfo { path: string info: JsAssetInfo diff --git a/crates/rspack_binding_values/src/compilation.rs b/crates/rspack_binding_values/src/compilation.rs index d0b963828ab..369a45837cf 100644 --- a/crates/rspack_binding_values/src/compilation.rs +++ b/crates/rspack_binding_values/src/compilation.rs @@ -20,7 +20,7 @@ use crate::JsStatsOptimizationBailout; use crate::LocalJsFilename; use crate::{ chunk::JsChunk, module::JsModule, CompatSource, JsAsset, JsAssetInfo, JsChunkGroup, - JsCompatSource, JsStats, PathData, ToJsCompatSource, + JsCompatSource, JsPathData, JsStats, ToJsCompatSource, }; #[napi(object_from_js = false)] @@ -335,7 +335,7 @@ impl JsCompilation { &self, #[napi(ts_arg_type = "string | ((pathData: PathData, assetInfo?: JsAssetInfo) => string)")] filename: LocalJsFilename, - data: PathData, + data: JsPathData, ) -> napi::Result { self .0 @@ -347,7 +347,7 @@ impl JsCompilation { &self, #[napi(ts_arg_type = "string | ((pathData: PathData, assetInfo?: JsAssetInfo) => string)")] filename: LocalJsFilename, - data: PathData, + data: JsPathData, ) -> napi::Result { let path_and_asset_info = self .0 @@ -360,7 +360,7 @@ impl JsCompilation { &self, #[napi(ts_arg_type = "string | ((pathData: PathData, assetInfo?: JsAssetInfo) => string)")] filename: LocalJsFilename, - data: PathData, + data: JsPathData, ) -> napi::Result { self.0.get_path(&filename.into(), data.as_core_path_data()) } @@ -370,7 +370,7 @@ impl JsCompilation { &self, #[napi(ts_arg_type = "string | ((pathData: PathData, assetInfo?: JsAssetInfo) => string)")] filename: LocalJsFilename, - data: PathData, + data: JsPathData, ) -> napi::Result { let path_and_asset_info = self .0 diff --git a/crates/rspack_binding_values/src/filename.rs b/crates/rspack_binding_values/src/filename.rs index 1f353ca0477..039f08ef438 100644 --- a/crates/rspack_binding_values/src/filename.rs +++ b/crates/rspack_binding_values/src/filename.rs @@ -7,10 +7,10 @@ use napi::{ }; use rspack_core::{AssetInfo, LocalFilenameFn, PathData}; use rspack_core::{Filename, FilenameFn}; -use rspack_napi::{threadsafe_function::ThreadsafeFunction, NapiResultExt}; +use rspack_napi::threadsafe_function::ThreadsafeFunction; use serde::Deserialize; -use crate::{JsAssetInfo, PathData as JsPathData}; +use crate::{JsAssetInfo, JsPathData}; /// A js filename value. Either a string or a function /// @@ -82,7 +82,7 @@ impl LocalFilenameFn for ThreadSafeFilenameFn { asset_info: Option<&AssetInfo>, ) -> rspack_error::Result { self.0.blocking_call_with_sync(( - JsPathData::try_from(*path_data).into_rspack_result()?, + JsPathData::from(*path_data), asset_info.cloned().map(JsAssetInfo::from), )) } @@ -100,7 +100,7 @@ impl LocalFilenameFn for LocalJsFilenameFn { path_data: &PathData, asset_info: Option<&AssetInfo>, ) -> Result { - let js_path_data = JsPathData::try_from(*path_data)?; + let js_path_data = JsPathData::from(*path_data); let js_asset_info = asset_info.cloned().map(JsAssetInfo::from); self.0.call2(js_path_data, js_asset_info) } diff --git a/crates/rspack_binding_values/src/path_data.rs b/crates/rspack_binding_values/src/path_data.rs index 83b9bf459b0..2aede5dc863 100644 --- a/crates/rspack_binding_values/src/path_data.rs +++ b/crates/rspack_binding_values/src/path_data.rs @@ -1,11 +1,12 @@ use std::collections::HashMap; +use napi::Either; use napi_derive::napi; use super::JsAssetInfo; #[napi(object)] -pub struct PathData { +pub struct JsPathData { pub filename: Option, pub hash: Option, pub content_hash: Option, @@ -15,10 +16,9 @@ pub struct PathData { pub chunk: Option, } -impl TryFrom> for PathData { - type Error = napi::Error; - fn try_from(path_data: rspack_core::PathData<'_>) -> Result { - Ok(Self { +impl From> for JsPathData { + fn from(path_data: rspack_core::PathData<'_>) -> Self { + Self { filename: path_data.filename.map(|s| s.to_string()), hash: path_data.hash.map(|s| s.to_string()), content_hash: path_data.content_hash.map(|s| s.to_string()), @@ -26,7 +26,7 @@ impl TryFrom> for PathData { url: path_data.url.map(|s| s.to_string()), id: path_data.id.map(|s| s.to_string()), chunk: path_data.chunk.map(JsChunkPathData::from), - }) + } } } @@ -35,7 +35,7 @@ pub struct JsChunkPathData { pub id: Option, pub name: Option, pub hash: Option, - pub content_hash: Option>, + pub content_hash: Option>>, } impl<'a> From<&'a rspack_core::Chunk> for JsChunkPathData { @@ -44,18 +44,18 @@ impl<'a> From<&'a rspack_core::Chunk> for JsChunkPathData { id: chunk.id.clone(), name: chunk.name.clone(), hash: chunk.hash.as_ref().map(|d| d.encoded().to_string()), - content_hash: Some( + content_hash: Some(Either::B( chunk .content_hash .iter() .map(|(key, v)| (key.to_string(), v.encoded().to_string())) .collect(), - ), + )), } } } -impl PathData { +impl JsPathData { pub fn as_core_path_data(&self) -> rspack_core::PathData { rspack_core::PathData { filename: self.filename.as_deref(), diff --git a/packages/rspack/etc/api.md b/packages/rspack/etc/api.md index f39eafd089f..81e6b814d61 100644 --- a/packages/rspack/etc/api.md +++ b/packages/rspack/etc/api.md @@ -32,6 +32,7 @@ import { JsCreateData } from '@rspack/binding'; import { JsLoaderContext } from '@rspack/binding'; import { JsLoaderResult } from '@rspack/binding'; import { JsModule } from '@rspack/binding'; +import { JsPathData } from '@rspack/binding'; import type { JsRuntimeModule } from '@rspack/binding'; import { JsStats } from '@rspack/binding'; import type { JsStatsChunk } from '@rspack/binding'; @@ -41,7 +42,6 @@ import { libCacheFacade } from './lib/CacheFacade'; import { LoaderContext as LoaderContext_2 } from './config'; import { Logger as Logger_2 } from './logging/Logger'; import { MultiHook } from 'tapable'; -import { PathData } from '@rspack/binding'; import { PathWithInfo } from '@rspack/binding'; import { RawBannerPluginOptions } from '@rspack/binding'; import { RawBuiltins } from '@rspack/binding'; @@ -382,6 +382,8 @@ export class Compilation { // // (undocumented) getLogger(name: string | (() => string)): Logger; + // Warning: (ae-forgotten-export) The symbol "PathData" needs to be exported by the entry point index.d.ts + // // (undocumented) getPath(filename: Filename, data?: PathData): string; // (undocumented) @@ -2278,11 +2280,11 @@ export const rspackOptions: z.ZodObject<{ path: z.ZodOptional; clean: z.ZodOptional; publicPath: z.ZodOptional, z.ZodString]>>; - filename: z.ZodOptional, z.ZodOptional>], z.ZodUnknown>, z.ZodString>]>>; - chunkFilename: z.ZodOptional, z.ZodOptional>], z.ZodUnknown>, z.ZodString>]>>; + filename: z.ZodOptional, z.ZodOptional>], z.ZodUnknown>, z.ZodString>]>>; + chunkFilename: z.ZodOptional, z.ZodOptional>], z.ZodUnknown>, z.ZodString>]>>; crossOriginLoading: z.ZodOptional, z.ZodEnum<["anonymous", "use-credentials"]>]>>; - cssFilename: z.ZodOptional, z.ZodOptional>], z.ZodUnknown>, z.ZodString>]>>; - cssChunkFilename: z.ZodOptional, z.ZodOptional>], z.ZodUnknown>, z.ZodString>]>>; + cssFilename: z.ZodOptional, z.ZodOptional>], z.ZodUnknown>, z.ZodString>]>>; + cssChunkFilename: z.ZodOptional, z.ZodOptional>], z.ZodUnknown>, z.ZodString>]>>; hotUpdateMainFilename: z.ZodOptional; hotUpdateChunkFilename: z.ZodOptional; hotUpdateGlobal: z.ZodOptional; @@ -2425,11 +2427,11 @@ export const rspackOptions: z.ZodObject<{ path?: string | undefined; clean?: boolean | undefined; publicPath?: string | undefined; - filename?: string | ((args_0: PathData, args_1: JsAssetInfo | undefined, ...args_2: unknown[]) => string) | undefined; - chunkFilename?: string | ((args_0: PathData, args_1: JsAssetInfo | undefined, ...args_2: unknown[]) => string) | undefined; + filename?: string | ((args_0: JsPathData, args_1: JsAssetInfo | undefined, ...args_2: unknown[]) => string) | undefined; + chunkFilename?: string | ((args_0: JsPathData, args_1: JsAssetInfo | undefined, ...args_2: unknown[]) => string) | undefined; crossOriginLoading?: false | "anonymous" | "use-credentials" | undefined; - cssFilename?: string | ((args_0: PathData, args_1: JsAssetInfo | undefined, ...args_2: unknown[]) => string) | undefined; - cssChunkFilename?: string | ((args_0: PathData, args_1: JsAssetInfo | undefined, ...args_2: unknown[]) => string) | undefined; + cssFilename?: string | ((args_0: JsPathData, args_1: JsAssetInfo | undefined, ...args_2: unknown[]) => string) | undefined; + cssChunkFilename?: string | ((args_0: JsPathData, args_1: JsAssetInfo | undefined, ...args_2: unknown[]) => string) | undefined; hotUpdateMainFilename?: string | undefined; hotUpdateChunkFilename?: string | undefined; hotUpdateGlobal?: string | undefined; @@ -2500,11 +2502,11 @@ export const rspackOptions: z.ZodObject<{ path?: string | undefined; clean?: boolean | undefined; publicPath?: string | undefined; - filename?: string | ((args_0: PathData, args_1: JsAssetInfo | undefined, ...args_2: unknown[]) => string) | undefined; - chunkFilename?: string | ((args_0: PathData, args_1: JsAssetInfo | undefined, ...args_2: unknown[]) => string) | undefined; + filename?: string | ((args_0: JsPathData, args_1: JsAssetInfo | undefined, ...args_2: unknown[]) => string) | undefined; + chunkFilename?: string | ((args_0: JsPathData, args_1: JsAssetInfo | undefined, ...args_2: unknown[]) => string) | undefined; crossOriginLoading?: false | "anonymous" | "use-credentials" | undefined; - cssFilename?: string | ((args_0: PathData, args_1: JsAssetInfo | undefined, ...args_2: unknown[]) => string) | undefined; - cssChunkFilename?: string | ((args_0: PathData, args_1: JsAssetInfo | undefined, ...args_2: unknown[]) => string) | undefined; + cssFilename?: string | ((args_0: JsPathData, args_1: JsAssetInfo | undefined, ...args_2: unknown[]) => string) | undefined; + cssChunkFilename?: string | ((args_0: JsPathData, args_1: JsAssetInfo | undefined, ...args_2: unknown[]) => string) | undefined; hotUpdateMainFilename?: string | undefined; hotUpdateChunkFilename?: string | undefined; hotUpdateGlobal?: string | undefined; @@ -3739,11 +3741,11 @@ export const rspackOptions: z.ZodObject<{ path?: string | undefined; clean?: boolean | undefined; publicPath?: string | undefined; - filename?: string | ((args_0: PathData, args_1: JsAssetInfo | undefined, ...args_2: unknown[]) => string) | undefined; - chunkFilename?: string | ((args_0: PathData, args_1: JsAssetInfo | undefined, ...args_2: unknown[]) => string) | undefined; + filename?: string | ((args_0: JsPathData, args_1: JsAssetInfo | undefined, ...args_2: unknown[]) => string) | undefined; + chunkFilename?: string | ((args_0: JsPathData, args_1: JsAssetInfo | undefined, ...args_2: unknown[]) => string) | undefined; crossOriginLoading?: false | "anonymous" | "use-credentials" | undefined; - cssFilename?: string | ((args_0: PathData, args_1: JsAssetInfo | undefined, ...args_2: unknown[]) => string) | undefined; - cssChunkFilename?: string | ((args_0: PathData, args_1: JsAssetInfo | undefined, ...args_2: unknown[]) => string) | undefined; + cssFilename?: string | ((args_0: JsPathData, args_1: JsAssetInfo | undefined, ...args_2: unknown[]) => string) | undefined; + cssChunkFilename?: string | ((args_0: JsPathData, args_1: JsAssetInfo | undefined, ...args_2: unknown[]) => string) | undefined; hotUpdateMainFilename?: string | undefined; hotUpdateChunkFilename?: string | undefined; hotUpdateGlobal?: string | undefined; @@ -4124,11 +4126,11 @@ export const rspackOptions: z.ZodObject<{ path?: string | undefined; clean?: boolean | undefined; publicPath?: string | undefined; - filename?: string | ((args_0: PathData, args_1: JsAssetInfo | undefined, ...args_2: unknown[]) => string) | undefined; - chunkFilename?: string | ((args_0: PathData, args_1: JsAssetInfo | undefined, ...args_2: unknown[]) => string) | undefined; + filename?: string | ((args_0: JsPathData, args_1: JsAssetInfo | undefined, ...args_2: unknown[]) => string) | undefined; + chunkFilename?: string | ((args_0: JsPathData, args_1: JsAssetInfo | undefined, ...args_2: unknown[]) => string) | undefined; crossOriginLoading?: false | "anonymous" | "use-credentials" | undefined; - cssFilename?: string | ((args_0: PathData, args_1: JsAssetInfo | undefined, ...args_2: unknown[]) => string) | undefined; - cssChunkFilename?: string | ((args_0: PathData, args_1: JsAssetInfo | undefined, ...args_2: unknown[]) => string) | undefined; + cssFilename?: string | ((args_0: JsPathData, args_1: JsAssetInfo | undefined, ...args_2: unknown[]) => string) | undefined; + cssChunkFilename?: string | ((args_0: JsPathData, args_1: JsAssetInfo | undefined, ...args_2: unknown[]) => string) | undefined; hotUpdateMainFilename?: string | undefined; hotUpdateChunkFilename?: string | undefined; hotUpdateGlobal?: string | undefined; @@ -4968,13 +4970,13 @@ export type WorkerPublicPath = z.infer; // Warnings were encountered during analysis: // -// dist/Compilation.d.ts:65:9 - (ae-forgotten-export) The symbol "liteTapable" needs to be exported by the entry point index.d.ts -// dist/Compilation.d.ts:70:9 - (ae-forgotten-export) The symbol "Module" needs to be exported by the entry point index.d.ts -// dist/Compilation.d.ts:72:9 - (ae-forgotten-export) The symbol "Chunk" needs to be exported by the entry point index.d.ts -// dist/Compilation.d.ts:85:9 - (ae-forgotten-export) The symbol "StatsFactory" needs to be exported by the entry point index.d.ts -// dist/Compilation.d.ts:86:9 - (ae-forgotten-export) The symbol "StatsPrinter" needs to be exported by the entry point index.d.ts -// dist/Compilation.d.ts:88:9 - (ae-forgotten-export) The symbol "ExecuteModuleArgument" needs to be exported by the entry point index.d.ts -// dist/Compilation.d.ts:88:9 - (ae-forgotten-export) The symbol "ExecuteModuleContext" needs to be exported by the entry point index.d.ts +// dist/Compilation.d.ts:66:9 - (ae-forgotten-export) The symbol "liteTapable" needs to be exported by the entry point index.d.ts +// dist/Compilation.d.ts:71:9 - (ae-forgotten-export) The symbol "Module" needs to be exported by the entry point index.d.ts +// dist/Compilation.d.ts:73:9 - (ae-forgotten-export) The symbol "Chunk" needs to be exported by the entry point index.d.ts +// dist/Compilation.d.ts:86:9 - (ae-forgotten-export) The symbol "StatsFactory" needs to be exported by the entry point index.d.ts +// dist/Compilation.d.ts:87:9 - (ae-forgotten-export) The symbol "StatsPrinter" needs to be exported by the entry point index.d.ts +// dist/Compilation.d.ts:89:9 - (ae-forgotten-export) The symbol "ExecuteModuleArgument" needs to be exported by the entry point index.d.ts +// dist/Compilation.d.ts:89:9 - (ae-forgotten-export) The symbol "ExecuteModuleContext" needs to be exported by the entry point index.d.ts // dist/Compiler.d.ts:82:9 - (ae-forgotten-export) The symbol "AssetEmittedInfo" needs to be exported by the entry point index.d.ts // dist/MultiCompiler.d.ts:35:9 - (ae-forgotten-export) The symbol "Any" needs to be exported by the entry point index.d.ts // dist/NormalModuleFactory.d.ts:9:9 - (ae-forgotten-export) The symbol "ResourceDataWithData" needs to be exported by the entry point index.d.ts diff --git a/packages/rspack/src/Compilation.ts b/packages/rspack/src/Compilation.ts index a347e07933c..9973597e848 100644 --- a/packages/rspack/src/Compilation.ts +++ b/packages/rspack/src/Compilation.ts @@ -20,7 +20,7 @@ import type { JsRuntimeModule, JsStatsChunk, JsStatsError, - PathData + JsPathData } from "@rspack/binding"; import { @@ -65,6 +65,9 @@ export interface Asset { source: Source; info: JsAssetInfo; } + +export type PathData = JsPathData; + export interface LogEntry { type: string; args: any[]; diff --git a/packages/rspack/src/config/zod.ts b/packages/rspack/src/config/zod.ts index 1fc6b085350..c4609d43f78 100644 --- a/packages/rspack/src/config/zod.ts +++ b/packages/rspack/src/config/zod.ts @@ -1,4 +1,4 @@ -import { RawFuncUseCtx, PathData, JsAssetInfo } from "@rspack/binding"; +import { RawFuncUseCtx, JsAssetInfo } from "@rspack/binding"; import { z } from "zod"; import { Compilation, Compiler } from ".."; import type * as oldBuiltins from "../builtin-plugin"; @@ -6,6 +6,7 @@ import type * as webpackDevServer from "webpack-dev-server"; import { deprecatedWarn } from "../util"; import { Module } from "../Module"; import { Chunk } from "../Chunk"; +import { PathData } from "../Compilation"; //#region Name const name = z.string(); diff --git a/packages/rspack/tests/configCases/hooks/compat-path-data-chunk-contenthash/index.js b/packages/rspack/tests/configCases/hooks/compat-path-data-chunk-contenthash/index.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rspack/tests/configCases/hooks/compat-path-data-chunk-contenthash/test.config.js b/packages/rspack/tests/configCases/hooks/compat-path-data-chunk-contenthash/test.config.js new file mode 100644 index 00000000000..2f4ccd7c8d8 --- /dev/null +++ b/packages/rspack/tests/configCases/hooks/compat-path-data-chunk-contenthash/test.config.js @@ -0,0 +1,3 @@ +module.exports = { + noTests: true, +} diff --git a/packages/rspack/tests/configCases/hooks/compat-path-data-chunk-contenthash/webpack.config.js b/packages/rspack/tests/configCases/hooks/compat-path-data-chunk-contenthash/webpack.config.js new file mode 100644 index 00000000000..55d3d5cec5d --- /dev/null +++ b/packages/rspack/tests/configCases/hooks/compat-path-data-chunk-contenthash/webpack.config.js @@ -0,0 +1,28 @@ +const pluginName = "plugin"; + +class Plugin { + apply(compiler) { + let called = false; + compiler.hooks.compilation.tap(pluginName, compilation => { + const p = compilation.getPath("[contenthash]", { + contentHash: "xxx1", + chunk: { + contentHash: "xxx2" + } + }); + called = true; + expect(p).toBe("xxx1") + }); + compiler.hooks.done.tap(pluginName, stats => { + let json = stats.toJson(); + expect(json.errors.length === 0); + expect(called).toBe(true); + }); + } +} + +/**@type {import('@rspack/cli').Configuration}*/ +module.exports = { + context: __dirname, + plugins: [new Plugin()] +}; From 98e4a726a7f39fc93ea3e8a76e252860aed19435 Mon Sep 17 00:00:00 2001 From: gaoyuan <9aoyuao@gmail.com> Date: Tue, 16 Apr 2024 18:35:10 +0800 Subject: [PATCH 06/15] feat: support checkResource option in IgnorePlugin (#6249) * feat(IIgnorePlugin): support checkResource option --- Cargo.lock | 2 + crates/node_binding/binding.d.ts | 3 +- .../src/options/raw_builtins/raw_ignore.rs | 25 ++++++++-- crates/rspack_plugin_ignore/Cargo.toml | 2 + crates/rspack_plugin_ignore/src/lib.rs | 50 +++++++++++++++---- packages/rspack/etc/api.md | 9 +++- .../rspack/src/builtin-plugin/IgnorePlugin.ts | 27 +++++++++- .../ignore/checkContext/test.filter.js | 1 - .../checkResource-one-argument/test.filter.js | 1 - .../test.filter.js | 1 - .../docs/en/plugins/webpack/ignore-plugin.mdx | 16 +++--- .../docs/zh/plugins/webpack/ignore-plugin.mdx | 16 +++--- 12 files changed, 118 insertions(+), 35 deletions(-) delete mode 100644 webpack-test/configCases/ignore/checkContext/test.filter.js delete mode 100644 webpack-test/configCases/ignore/checkResource-one-argument/test.filter.js delete mode 100644 webpack-test/configCases/ignore/checkResource-two-arguments/test.filter.js diff --git a/Cargo.lock b/Cargo.lock index 89284e72131..79a717f02f3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3314,6 +3314,8 @@ dependencies = [ name = "rspack_plugin_ignore" version = "0.1.0" dependencies = [ + "derivative", + "futures", "rspack_core", "rspack_error", "rspack_hook", diff --git a/crates/node_binding/binding.d.ts b/crates/node_binding/binding.d.ts index 8f34345a830..bdc11e6caaa 100644 --- a/crates/node_binding/binding.d.ts +++ b/crates/node_binding/binding.d.ts @@ -896,8 +896,9 @@ export interface RawHttpExternalsRspackPluginOptions { } export interface RawIgnorePluginOptions { - resourceRegExp: RegExp + resourceRegExp?: RegExp contextRegExp?: RegExp + checkResource?: (resource: string, context: string) => boolean } export interface RawInfo { diff --git a/crates/rspack_binding_options/src/options/raw_builtins/raw_ignore.rs b/crates/rspack_binding_options/src/options/raw_builtins/raw_ignore.rs index 3c224ba0571..c1272f770b0 100644 --- a/crates/rspack_binding_options/src/options/raw_builtins/raw_ignore.rs +++ b/crates/rspack_binding_options/src/options/raw_builtins/raw_ignore.rs @@ -1,25 +1,42 @@ use derivative::Derivative; use napi_derive::napi; -use rspack_napi::regexp::{JsRegExp, JsRegExpExt}; -use rspack_plugin_ignore::IgnorePluginOptions; +use rspack_napi::{ + regexp::{JsRegExp, JsRegExpExt}, + threadsafe_function::ThreadsafeFunction, +}; +use rspack_plugin_ignore::{CheckResourceContent, IgnorePluginOptions}; + +type RawCheckResource = ThreadsafeFunction<(String, String), bool>; #[derive(Derivative)] #[derivative(Debug)] #[napi(object, object_to_js = false)] pub struct RawIgnorePluginOptions { #[napi(ts_type = "RegExp")] - pub resource_reg_exp: JsRegExp, + pub resource_reg_exp: Option, #[napi(ts_type = "RegExp")] pub context_reg_exp: Option, + #[napi(ts_type = "(resource: string, context: string) => boolean")] + pub check_resource: Option, } impl From for IgnorePluginOptions { fn from(value: RawIgnorePluginOptions) -> Self { Self { - resource_reg_exp: value.resource_reg_exp.to_rspack_regex(), + resource_reg_exp: value + .resource_reg_exp + .map(|resource_reg_exp| resource_reg_exp.to_rspack_regex()), context_reg_exp: value .context_reg_exp .map(|context_reg_exp| context_reg_exp.to_rspack_regex()), + + check_resource: value.check_resource.map(|check_resource| { + CheckResourceContent::Fn(Box::new(move |resource, context| { + let f = check_resource.clone(); + + Box::pin(async move { f.call((resource.to_owned(), context.to_owned())).await }) + })) + }), } } } diff --git a/crates/rspack_plugin_ignore/Cargo.toml b/crates/rspack_plugin_ignore/Cargo.toml index 24b90e1086b..1fd420cf030 100644 --- a/crates/rspack_plugin_ignore/Cargo.toml +++ b/crates/rspack_plugin_ignore/Cargo.toml @@ -8,6 +8,8 @@ version = "0.1.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] +derivative = { workspace = true } +futures = { workspace = true } rspack_core = { path = "../rspack_core" } rspack_error = { path = "../rspack_error" } rspack_hook = { path = "../rspack_hook" } diff --git a/crates/rspack_plugin_ignore/src/lib.rs b/crates/rspack_plugin_ignore/src/lib.rs index 579a7bba8f9..32fea1f2209 100644 --- a/crates/rspack_plugin_ignore/src/lib.rs +++ b/crates/rspack_plugin_ignore/src/lib.rs @@ -1,5 +1,7 @@ use std::fmt::Debug; +use derivative::Derivative; +use futures::future::BoxFuture; use rspack_core::{ ApplyContext, CompilerOptions, ContextModuleFactoryBeforeResolve, ModuleFactoryCreateData, NormalModuleFactoryBeforeResolve, Plugin, PluginContext, @@ -8,10 +10,20 @@ use rspack_error::Result; use rspack_hook::{plugin, plugin_hook}; use rspack_regex::RspackRegex; -#[derive(Debug)] +pub type CheckResourceFn = + Box Fn(&'a str, &'a str) -> BoxFuture<'a, Result> + Sync + Send>; + +pub enum CheckResourceContent { + Fn(CheckResourceFn), +} + +#[derive(Derivative)] +#[derivative(Debug)] pub struct IgnorePluginOptions { - pub resource_reg_exp: RspackRegex, + pub resource_reg_exp: Option, pub context_reg_exp: Option, + #[derivative(Debug = "ignore")] + pub check_resource: Option, } #[plugin] @@ -25,30 +37,46 @@ impl IgnorePlugin { Self::new_inner(options) } - fn check_ignore(&self, data: &mut ModuleFactoryCreateData) -> Option { - let resource_reg_exp: &RspackRegex = &self.options.resource_reg_exp; + async fn check_ignore(&self, data: &mut ModuleFactoryCreateData) -> Option { + if let Some(check_resource) = &self.options.check_resource { + if let Some(request) = data.request() { + match check_resource { + CheckResourceContent::Fn(check) => { + if check(request, data.context.as_ref()) + .await + .expect("run IgnorePlugin check resource error") + { + return Some(false); + } + } + } + } + } - if resource_reg_exp.test(data.request()?) { - if let Some(context_reg_exp) = &self.options.context_reg_exp { - if context_reg_exp.test(&data.context) { + if let Some(resource_reg_exp) = &self.options.resource_reg_exp { + if resource_reg_exp.test(data.request()?) { + if let Some(context_reg_exp) = &self.options.context_reg_exp { + if context_reg_exp.test(&data.context) { + return Some(false); + } + } else { return Some(false); } - } else { - return Some(false); } } + None } } #[plugin_hook(NormalModuleFactoryBeforeResolve for IgnorePlugin)] async fn nmf_before_resolve(&self, data: &mut ModuleFactoryCreateData) -> Result> { - Ok(self.check_ignore(data)) + Ok(self.check_ignore(data).await) } #[plugin_hook(ContextModuleFactoryBeforeResolve for IgnorePlugin)] async fn cmf_before_resolve(&self, data: &mut ModuleFactoryCreateData) -> Result> { - Ok(self.check_ignore(data)) + Ok(self.check_ignore(data).await) } impl Plugin for IgnorePlugin { diff --git a/packages/rspack/etc/api.md b/packages/rspack/etc/api.md index 81e6b814d61..6af0bffde8c 100644 --- a/packages/rspack/etc/api.md +++ b/packages/rspack/etc/api.md @@ -1276,7 +1276,7 @@ export type HtmlRspackPluginOptions = z.infer; // @public (undocumented) export const IgnorePlugin: { - new (options: RawIgnorePluginOptions): { + new (options: IgnorePluginOptions): { name: BuiltinPluginName; _options: RawIgnorePluginOptions; affectedHooks: "done" | "compilation" | "make" | "compile" | "emit" | "afterEmit" | "invalid" | "thisCompilation" | "afterDone" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "failed" | "shutdown" | "watchRun" | "watchClose" | "environment" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | undefined; @@ -1286,7 +1286,12 @@ export const IgnorePlugin: { }; // @public (undocumented) -export type IgnorePluginOptions = RawIgnorePluginOptions; +export type IgnorePluginOptions = { + resourceRegExp: NonNullable; + contextRegExp?: RawIgnorePluginOptions["contextRegExp"]; +} | { + checkResource: NonNullable; +}; // Warning: (ae-forgotten-export) The symbol "ignoreWarnings" needs to be exported by the entry point index.d.ts // diff --git a/packages/rspack/src/builtin-plugin/IgnorePlugin.ts b/packages/rspack/src/builtin-plugin/IgnorePlugin.ts index 603ffc6fbe3..319a7f85b76 100644 --- a/packages/rspack/src/builtin-plugin/IgnorePlugin.ts +++ b/packages/rspack/src/builtin-plugin/IgnorePlugin.ts @@ -1,9 +1,32 @@ import { BuiltinPluginName, RawIgnorePluginOptions } from "@rspack/binding"; +import { z } from "zod"; +import { validate } from "../util/validate"; import { create } from "./base"; -export type IgnorePluginOptions = RawIgnorePluginOptions; +export type IgnorePluginOptions = + | { + resourceRegExp: NonNullable; + contextRegExp?: RawIgnorePluginOptions["contextRegExp"]; + } + | { + checkResource: NonNullable; + }; + +const IgnorePluginOptions = z.union([ + z.object({ + contextRegExp: z.instanceof(RegExp).optional(), + resourceRegExp: z.instanceof(RegExp) + }), + z.object({ + checkResource: z.function(z.tuple([z.string(), z.string()]), z.boolean()) + }) +]); export const IgnorePlugin = create( BuiltinPluginName.IgnorePlugin, - (options: IgnorePluginOptions): RawIgnorePluginOptions => options + (options: IgnorePluginOptions): RawIgnorePluginOptions => { + validate(options, IgnorePluginOptions); + + return options; + } ); diff --git a/webpack-test/configCases/ignore/checkContext/test.filter.js b/webpack-test/configCases/ignore/checkContext/test.filter.js deleted file mode 100644 index 195b69e3209..00000000000 --- a/webpack-test/configCases/ignore/checkContext/test.filter.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = () => {return 'filter function is not yet supported in rspack'} diff --git a/webpack-test/configCases/ignore/checkResource-one-argument/test.filter.js b/webpack-test/configCases/ignore/checkResource-one-argument/test.filter.js deleted file mode 100644 index 3be456dcd23..00000000000 --- a/webpack-test/configCases/ignore/checkResource-one-argument/test.filter.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = () => {return false} \ No newline at end of file diff --git a/webpack-test/configCases/ignore/checkResource-two-arguments/test.filter.js b/webpack-test/configCases/ignore/checkResource-two-arguments/test.filter.js deleted file mode 100644 index 3be456dcd23..00000000000 --- a/webpack-test/configCases/ignore/checkResource-two-arguments/test.filter.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = () => {return false} \ No newline at end of file diff --git a/website/docs/en/plugins/webpack/ignore-plugin.mdx b/website/docs/en/plugins/webpack/ignore-plugin.mdx index 225083bb916..ea9e794e02a 100644 --- a/website/docs/en/plugins/webpack/ignore-plugin.mdx +++ b/website/docs/en/plugins/webpack/ignore-plugin.mdx @@ -15,12 +15,16 @@ new rspack.IgnorePlugin(options); - **Type:** ```ts -{ - /** A RegExp to test the resource against. */ - resourceRegExp: RegExp; - /** A RegExp to test the context (directory) against. */ - contextRegExp?: RegExp; -} +| { + /** A RegExp to test the resource against. */ + resourceRegExp: RegExp; + /** A RegExp to test the context (directory) against. */ + contextRegExp?: RegExp; + } +| { + /** A Filter function that receives `resource` and `context` as arguments, must return boolean. */ + checkResource: (resource: string, context: string) => boolean; + } ``` - **Default:** `undefined` diff --git a/website/docs/zh/plugins/webpack/ignore-plugin.mdx b/website/docs/zh/plugins/webpack/ignore-plugin.mdx index 1c97d4ef936..c7cc1055e5a 100644 --- a/website/docs/zh/plugins/webpack/ignore-plugin.mdx +++ b/website/docs/zh/plugins/webpack/ignore-plugin.mdx @@ -15,12 +15,16 @@ new rspack.IgnorePlugin(options); - **类型:** ```ts -{ - /** 用于匹配资源文件 */ - resourceRegExp: RegExp; - /** 用于匹配请求的目录 */ - contextRegExp?: RegExp; -} +| { + /** 用于匹配资源文件 */ + resourceRegExp: RegExp; + /** 用于匹配请求的目录 */ + contextRegExp?: RegExp; + } +| { + /** 根据资源和请求的目录进行过滤 */ + checkResource: (resource: string, context: string) => boolean; + } ``` - **默认值:** `undefined` From 232084071793f9bcfcc6a331297a068318222df6 Mon Sep 17 00:00:00 2001 From: neverland Date: Tue, 16 Apr 2024 22:34:46 +0800 Subject: [PATCH 07/15] feat: add `emit` option for asset modules (#6255) --- crates/node_binding/binding.d.ts | 2 + .../src/options/raw_module/mod.rs | 4 ++ crates/rspack_core/src/options/module.rs | 9 +++++ crates/rspack_plugin_asset/src/lib.rs | 32 ++++++++++++--- packages/rspack/etc/api.md | 20 +++++++++- packages/rspack/src/config/adapter.ts | 1 + packages/rspack/src/config/zod.ts | 1 + .../tests/configCases/asset/_images/file.jpg | Bin 0 -> 631 bytes .../tests/configCases/asset/_images/file.png | Bin 0 -> 95 bytes .../asset/disable-emit-by-rule/index.js | 12 ++++++ .../disable-emit-by-rule/webpack.config.js | 22 +++++++++++ .../asset/disable-emit-for-asset/index.js | 12 ++++++ .../disable-emit-for-asset/webpack.config.js | 31 +++++++++++++++ .../asset/disable-emit-for-resource/index.js | 12 ++++++ .../webpack.config.js | 24 ++++++++++++ .../asset-modules/emit/test.filter.js | 1 - website/docs/en/config/module.mdx | 37 ++++++++++++++++++ website/docs/zh/config/module.mdx | 37 ++++++++++++++++++ 18 files changed, 249 insertions(+), 8 deletions(-) create mode 100644 packages/rspack/tests/configCases/asset/_images/file.jpg create mode 100644 packages/rspack/tests/configCases/asset/_images/file.png create mode 100644 packages/rspack/tests/configCases/asset/disable-emit-by-rule/index.js create mode 100644 packages/rspack/tests/configCases/asset/disable-emit-by-rule/webpack.config.js create mode 100644 packages/rspack/tests/configCases/asset/disable-emit-for-asset/index.js create mode 100644 packages/rspack/tests/configCases/asset/disable-emit-for-asset/webpack.config.js create mode 100644 packages/rspack/tests/configCases/asset/disable-emit-for-resource/index.js create mode 100644 packages/rspack/tests/configCases/asset/disable-emit-for-resource/webpack.config.js delete mode 100644 webpack-test/configCases/asset-modules/emit/test.filter.js diff --git a/crates/node_binding/binding.d.ts b/crates/node_binding/binding.d.ts index bdc11e6caaa..fccb0379c36 100644 --- a/crates/node_binding/binding.d.ts +++ b/crates/node_binding/binding.d.ts @@ -580,6 +580,7 @@ export interface RawAssetGeneratorDataUrlOptions { } export interface RawAssetGeneratorOptions { + emit?: boolean filename?: string publicPath?: string dataUrl?: RawAssetGeneratorDataUrlOptions | ((arg: RawAssetGeneratorDataUrlFnArgs) => string) @@ -603,6 +604,7 @@ export interface RawAssetParserOptions { } export interface RawAssetResourceGeneratorOptions { + emit?: boolean filename?: string publicPath?: string } diff --git a/crates/rspack_binding_options/src/options/raw_module/mod.rs b/crates/rspack_binding_options/src/options/raw_module/mod.rs index af06493500f..4ffcd6c09c0 100644 --- a/crates/rspack_binding_options/src/options/raw_module/mod.rs +++ b/crates/rspack_binding_options/src/options/raw_module/mod.rs @@ -520,6 +520,7 @@ impl From for GeneratorOptions { #[serde(rename_all = "camelCase")] #[napi(object, object_to_js = false)] pub struct RawAssetGeneratorOptions { + pub emit: Option, pub filename: Option, pub public_path: Option, #[derivative(Debug = "ignore")] @@ -533,6 +534,7 @@ pub struct RawAssetGeneratorOptions { impl From for AssetGeneratorOptions { fn from(value: RawAssetGeneratorOptions) -> Self { Self { + emit: value.emit, filename: value.filename.map(|i| i.into()), public_path: value.public_path.map(|i| i.into()), data_url: value @@ -569,6 +571,7 @@ impl From for AssetInlineGeneratorOptions { #[serde(rename_all = "camelCase")] #[napi(object)] pub struct RawAssetResourceGeneratorOptions { + pub emit: Option, pub filename: Option, pub public_path: Option, } @@ -576,6 +579,7 @@ pub struct RawAssetResourceGeneratorOptions { impl From for AssetResourceGeneratorOptions { fn from(value: RawAssetResourceGeneratorOptions) -> Self { Self { + emit: value.emit, filename: value.filename.map(|i| i.into()), public_path: value.public_path.map(|i| i.into()), } diff --git a/crates/rspack_core/src/options/module.rs b/crates/rspack_core/src/options/module.rs index 91ec3dae8bf..aad614db8a5 100644 --- a/crates/rspack_core/src/options/module.rs +++ b/crates/rspack_core/src/options/module.rs @@ -253,6 +253,13 @@ impl GeneratorOptions { .and_then(|x| x.data_url.as_ref()) }) } + + pub fn asset_emit(&self, module_type: &ModuleType) -> Option { + self + .get_asset(module_type) + .and_then(|x| x.emit) + .or_else(|| self.get_asset_resource(module_type).and_then(|x| x.emit)) + } } #[derive(Debug, Clone, MergeFrom)] @@ -262,12 +269,14 @@ pub struct AssetInlineGeneratorOptions { #[derive(Debug, Clone, MergeFrom)] pub struct AssetResourceGeneratorOptions { + pub emit: Option, pub filename: Option, pub public_path: Option, } #[derive(Debug, Clone, MergeFrom)] pub struct AssetGeneratorOptions { + pub emit: Option, pub filename: Option, pub public_path: Option, pub data_url: Option, diff --git a/crates/rspack_plugin_asset/src/lib.rs b/crates/rspack_plugin_asset/src/lib.rs index 0e395e0eaf5..bbbdab8cab6 100644 --- a/crates/rspack_plugin_asset/src/lib.rs +++ b/crates/rspack_plugin_asset/src/lib.rs @@ -68,13 +68,15 @@ impl CanonicalizedDataUrlOption { #[derive(Debug)] pub struct AssetParserAndGenerator { + emit: bool, data_url: DataUrlOptions, parsed_asset_config: Option, } impl AssetParserAndGenerator { - pub fn with_auto(option: Option) -> Self { + pub fn with_auto(option: Option, emit: bool) -> Self { Self { + emit, data_url: DataUrlOptions::Auto(option), parsed_asset_config: None, } @@ -82,13 +84,15 @@ impl AssetParserAndGenerator { pub fn with_inline() -> Self { Self { + emit: false, data_url: DataUrlOptions::Inline(true), parsed_asset_config: None, } } - pub fn with_resource() -> Self { + pub fn with_resource(emit: bool) -> Self { Self { + emit, data_url: DataUrlOptions::Inline(false), parsed_asset_config: None, } @@ -96,6 +100,7 @@ impl AssetParserAndGenerator { pub fn with_source() -> Self { Self { + emit: false, data_url: DataUrlOptions::Source, parsed_asset_config: None, } @@ -210,7 +215,7 @@ const DEFAULT_MAX_SIZE: u32 = 8096; impl ParserAndGenerator for AssetParserAndGenerator { fn source_types(&self) -> &[SourceType] { if let Some(config) = self.parsed_asset_config.as_ref() { - if config.is_source() || config.is_inline() { + if config.is_source() || config.is_inline() || !self.emit { ASSET_SOURCE_MODULE_SOURCE_TYPE_LIST } else { ASSET_MODULE_SOURCE_TYPE_LIST @@ -589,23 +594,38 @@ impl Plugin for AssetPlugin { ctx.context.register_parser_and_generator_builder( rspack_core::ModuleType::Asset, - Box::new(move |p, _| { - let data_url_condition = p + Box::new(move |parser_options, generator_options| { + let data_url_condition = parser_options .and_then(|x| x.get_asset(&ModuleType::Asset)) .and_then(|x| x.data_url_condition.clone()); + + let emit: Option = generator_options + .and_then(|x| x.get_asset(&ModuleType::Asset)) + .and_then(|x| x.emit); + Box::new(AssetParserAndGenerator::with_auto( data_url_condition.clone(), + emit.unwrap_or(true), )) }), ); + ctx.context.register_parser_and_generator_builder( rspack_core::ModuleType::AssetInline, Box::new(|_, _| Box::new(AssetParserAndGenerator::with_inline())), ); + ctx.context.register_parser_and_generator_builder( rspack_core::ModuleType::AssetResource, - Box::new(move |_, _| Box::new(AssetParserAndGenerator::with_resource())), + Box::new(move |_, generator_options| { + let emit = generator_options + .and_then(|x| x.get_asset_resource(&ModuleType::AssetResource)) + .and_then(|x| x.emit); + + Box::new(AssetParserAndGenerator::with_resource(emit.unwrap_or(true))) + }), ); + ctx.context.register_parser_and_generator_builder( rspack_core::ModuleType::AssetSource, Box::new(move |_, _| Box::new(AssetParserAndGenerator::with_source())), diff --git a/packages/rspack/etc/api.md b/packages/rspack/etc/api.md index 6af0bffde8c..381469aae55 100644 --- a/packages/rspack/etc/api.md +++ b/packages/rspack/etc/api.md @@ -3363,6 +3363,7 @@ export const rspackOptions: z.ZodObject<{ filename: string; content: string; }>], z.ZodUnknown>, z.ZodString>]>>; + emit: z.ZodOptional; filename: z.ZodOptional; publicPath: z.ZodOptional, z.ZodString]>>; }, "strict", z.ZodTypeAny, { @@ -3373,6 +3374,7 @@ export const rspackOptions: z.ZodObject<{ filename: string; content: string; }, ...args_1: unknown[]) => string) | undefined; + emit?: boolean | undefined; filename?: string | undefined; publicPath?: string | undefined; }, { @@ -3383,6 +3385,7 @@ export const rspackOptions: z.ZodObject<{ filename: string; content: string; }, ...args_1: unknown[]) => string) | undefined; + emit?: boolean | undefined; filename?: string | undefined; publicPath?: string | undefined; }>>; @@ -3424,12 +3427,15 @@ export const rspackOptions: z.ZodObject<{ }, ...args_1: unknown[]) => string) | undefined; }>>; "asset/resource": z.ZodOptional; filename: z.ZodOptional; publicPath: z.ZodOptional, z.ZodString]>>; }, "strict", z.ZodTypeAny, { + emit?: boolean | undefined; filename?: string | undefined; publicPath?: string | undefined; }, { + emit?: boolean | undefined; filename?: string | undefined; publicPath?: string | undefined; }>>; @@ -3478,6 +3484,7 @@ export const rspackOptions: z.ZodObject<{ filename: string; content: string; }, ...args_1: unknown[]) => string) | undefined; + emit?: boolean | undefined; filename?: string | undefined; publicPath?: string | undefined; } | undefined; @@ -3491,6 +3498,7 @@ export const rspackOptions: z.ZodObject<{ }, ...args_1: unknown[]) => string) | undefined; } | undefined; "asset/resource"?: { + emit?: boolean | undefined; filename?: string | undefined; publicPath?: string | undefined; } | undefined; @@ -3517,6 +3525,7 @@ export const rspackOptions: z.ZodObject<{ filename: string; content: string; }, ...args_1: unknown[]) => string) | undefined; + emit?: boolean | undefined; filename?: string | undefined; publicPath?: string | undefined; } | undefined; @@ -3530,6 +3539,7 @@ export const rspackOptions: z.ZodObject<{ }, ...args_1: unknown[]) => string) | undefined; } | undefined; "asset/resource"?: { + emit?: boolean | undefined; filename?: string | undefined; publicPath?: string | undefined; } | undefined; @@ -3583,6 +3593,7 @@ export const rspackOptions: z.ZodObject<{ filename: string; content: string; }, ...args_1: unknown[]) => string) | undefined; + emit?: boolean | undefined; filename?: string | undefined; publicPath?: string | undefined; } | undefined; @@ -3596,6 +3607,7 @@ export const rspackOptions: z.ZodObject<{ }, ...args_1: unknown[]) => string) | undefined; } | undefined; "asset/resource"?: { + emit?: boolean | undefined; filename?: string | undefined; publicPath?: string | undefined; } | undefined; @@ -3649,6 +3661,7 @@ export const rspackOptions: z.ZodObject<{ filename: string; content: string; }, ...args_1: unknown[]) => string) | undefined; + emit?: boolean | undefined; filename?: string | undefined; publicPath?: string | undefined; } | undefined; @@ -3662,6 +3675,7 @@ export const rspackOptions: z.ZodObject<{ }, ...args_1: unknown[]) => string) | undefined; } | undefined; "asset/resource"?: { + emit?: boolean | undefined; filename?: string | undefined; publicPath?: string | undefined; } | undefined; @@ -4034,6 +4048,7 @@ export const rspackOptions: z.ZodObject<{ filename: string; content: string; }, ...args_1: unknown[]) => string) | undefined; + emit?: boolean | undefined; filename?: string | undefined; publicPath?: string | undefined; } | undefined; @@ -4047,6 +4062,7 @@ export const rspackOptions: z.ZodObject<{ }, ...args_1: unknown[]) => string) | undefined; } | undefined; "asset/resource"?: { + emit?: boolean | undefined; filename?: string | undefined; publicPath?: string | undefined; } | undefined; @@ -4419,6 +4435,7 @@ export const rspackOptions: z.ZodObject<{ filename: string; content: string; }, ...args_1: unknown[]) => string) | undefined; + emit?: boolean | undefined; filename?: string | undefined; publicPath?: string | undefined; } | undefined; @@ -4432,6 +4449,7 @@ export const rspackOptions: z.ZodObject<{ }, ...args_1: unknown[]) => string) | undefined; } | undefined; "asset/resource"?: { + emit?: boolean | undefined; filename?: string | undefined; publicPath?: string | undefined; } | undefined; @@ -4994,7 +5012,7 @@ export type WorkerPublicPath = z.infer; // dist/builtin-plugin/SwcJsMinimizerPlugin.d.ts:43:5 - (ae-forgotten-export) The symbol "ToSnakeCaseProperties" needs to be exported by the entry point index.d.ts // dist/builtin-plugin/SwcJsMinimizerPlugin.d.ts:45:5 - (ae-forgotten-export) The symbol "MinifyConditions" needs to be exported by the entry point index.d.ts // dist/config/adapterRuleUse.d.ts:145:5 - (ae-forgotten-export) The symbol "PitchLoaderDefinitionFunction" needs to be exported by the entry point index.d.ts -// dist/config/zod.d.ts:5264:5 - (ae-forgotten-export) The symbol "oldBuiltins" needs to be exported by the entry point index.d.ts +// dist/config/zod.d.ts:5304:5 - (ae-forgotten-export) The symbol "oldBuiltins" needs to be exported by the entry point index.d.ts // dist/exports.d.ts:103:5 - (ae-forgotten-export) The symbol "ContainerPlugin" needs to be exported by the entry point index.d.ts // dist/exports.d.ts:104:5 - (ae-forgotten-export) The symbol "ContainerReferencePlugin" needs to be exported by the entry point index.d.ts // dist/exports.d.ts:105:5 - (ae-forgotten-export) The symbol "ModuleFederationPlugin" needs to be exported by the entry point index.d.ts diff --git a/packages/rspack/src/config/adapter.ts b/packages/rspack/src/config/adapter.ts index 4d1a6459436..863c28c6e20 100644 --- a/packages/rspack/src/config/adapter.ts +++ b/packages/rspack/src/config/adapter.ts @@ -717,6 +717,7 @@ function getRawAssetResourceGeneratorOptions( options: AssetResourceGeneratorOptions ): RawAssetResourceGeneratorOptions { return { + emit: options.emit, filename: options.filename, publicPath: options.publicPath }; diff --git a/packages/rspack/src/config/zod.ts b/packages/rspack/src/config/zod.ts index c4609d43f78..07cb7c99d68 100644 --- a/packages/rspack/src/config/zod.ts +++ b/packages/rspack/src/config/zod.ts @@ -625,6 +625,7 @@ export type AssetInlineGeneratorOptions = z.infer< >; const assetResourceGeneratorOptions = z.strictObject({ + emit: z.boolean().optional(), filename: filenameTemplate.optional(), publicPath: publicPath.optional() }); diff --git a/packages/rspack/tests/configCases/asset/_images/file.jpg b/packages/rspack/tests/configCases/asset/_images/file.jpg new file mode 100644 index 0000000000000000000000000000000000000000..1cda9a53dc357ce07d3c67051b7615ebf7dc2f64 GIT binary patch literal 631 zcmex=^(PF6}rMnOeST|r4lSw=>~TvNxu(8R<ECr+Na zbot8FYu9hwy!G(W<0ns_J%91?)yGetzkL1n{m0K=Ab&A3Fhjfr_ZgbM1cClyVqsxs zVF&q(k*OSrnFU!`6%E;h90S=C3x$=88aYIqCNA7~kW<+>=!0ld(M2vX6_bamA3L7B$%azX<@d&d)*s literal 0 HcmV?d00001 diff --git a/packages/rspack/tests/configCases/asset/_images/file.png b/packages/rspack/tests/configCases/asset/_images/file.png new file mode 100644 index 0000000000000000000000000000000000000000..1914264c08781d1f30ee0b8482bccf44586f2dc1 GIT binary patch literal 95 zcmeAS@N?(olHy`uVBq!ia0vp^j3CU&3?x-=hn)ga%mF?ju0VQumF+E%TuG2$FoVOh l8)-lem#2$k2*>s01R$Gz9%CSj!PC{xWt~$(697H@6ZHT9 literal 0 HcmV?d00001 diff --git a/packages/rspack/tests/configCases/asset/disable-emit-by-rule/index.js b/packages/rspack/tests/configCases/asset/disable-emit-by-rule/index.js new file mode 100644 index 00000000000..a534ccf01e7 --- /dev/null +++ b/packages/rspack/tests/configCases/asset/disable-emit-by-rule/index.js @@ -0,0 +1,12 @@ +import url from "../_images/file.png"; +import url2 from "../_images/file.jpg"; +import fs from "fs"; +import path from "path"; + +it("should not output asset when emit is false", () => { + expect(url).toEqual("images/file.png"); + expect(url2).toEqual("images/file.jpg"); + + expect(fs.existsSync(path.join(__STATS__.outputPath, url))).toBe(false); + expect(fs.existsSync(path.join(__STATS__.outputPath, url2))).toBe(true); +}); diff --git a/packages/rspack/tests/configCases/asset/disable-emit-by-rule/webpack.config.js b/packages/rspack/tests/configCases/asset/disable-emit-by-rule/webpack.config.js new file mode 100644 index 00000000000..2fa01a341ab --- /dev/null +++ b/packages/rspack/tests/configCases/asset/disable-emit-by-rule/webpack.config.js @@ -0,0 +1,22 @@ +/** @type {import("@rspack/core").Configuration} */ +module.exports = { + context: __dirname, + output: { + assetModuleFilename: "images/file[ext]" + }, + module: { + rules: [ + { + test: /\.png$/, + type: "asset/resource", + generator: { + emit: false + } + }, + { + test: /\.jpg$/, + type: "asset/resource" + } + ] + } +}; diff --git a/packages/rspack/tests/configCases/asset/disable-emit-for-asset/index.js b/packages/rspack/tests/configCases/asset/disable-emit-for-asset/index.js new file mode 100644 index 00000000000..9a544a6325e --- /dev/null +++ b/packages/rspack/tests/configCases/asset/disable-emit-for-asset/index.js @@ -0,0 +1,12 @@ +import url from "../_images/file.png"; +import url2 from "../_images/file.jpg"; +import fs from "fs"; +import path from "path"; + +it("should not output asset when emit is false", () => { + expect(url).toEqual("images/file.png"); + expect(url2).toEqual("images/file.jpg"); + + expect(fs.existsSync(path.join(__STATS__.outputPath, url))).toBe(false); + expect(fs.existsSync(path.join(__STATS__.outputPath, url2))).toBe(false); +}); diff --git a/packages/rspack/tests/configCases/asset/disable-emit-for-asset/webpack.config.js b/packages/rspack/tests/configCases/asset/disable-emit-for-asset/webpack.config.js new file mode 100644 index 00000000000..dfe5921ac5f --- /dev/null +++ b/packages/rspack/tests/configCases/asset/disable-emit-for-asset/webpack.config.js @@ -0,0 +1,31 @@ +/** @type {import("@rspack/core").Configuration} */ +module.exports = { + context: __dirname, + output: { + assetModuleFilename: "images/file[ext]" + }, + module: { + generator: { + asset: { + emit: false, + }, + }, + parser: { + asset: { + dataUrlCondition: { + maxSize: 0 + } + } + }, + rules: [ + { + test: /\.png$/, + type: "asset", + }, + { + test: /\.jpg$/, + type: "asset" + } + ] + } +}; diff --git a/packages/rspack/tests/configCases/asset/disable-emit-for-resource/index.js b/packages/rspack/tests/configCases/asset/disable-emit-for-resource/index.js new file mode 100644 index 00000000000..9a544a6325e --- /dev/null +++ b/packages/rspack/tests/configCases/asset/disable-emit-for-resource/index.js @@ -0,0 +1,12 @@ +import url from "../_images/file.png"; +import url2 from "../_images/file.jpg"; +import fs from "fs"; +import path from "path"; + +it("should not output asset when emit is false", () => { + expect(url).toEqual("images/file.png"); + expect(url2).toEqual("images/file.jpg"); + + expect(fs.existsSync(path.join(__STATS__.outputPath, url))).toBe(false); + expect(fs.existsSync(path.join(__STATS__.outputPath, url2))).toBe(false); +}); diff --git a/packages/rspack/tests/configCases/asset/disable-emit-for-resource/webpack.config.js b/packages/rspack/tests/configCases/asset/disable-emit-for-resource/webpack.config.js new file mode 100644 index 00000000000..b855c7dae39 --- /dev/null +++ b/packages/rspack/tests/configCases/asset/disable-emit-for-resource/webpack.config.js @@ -0,0 +1,24 @@ +/** @type {import("@rspack/core").Configuration} */ +module.exports = { + context: __dirname, + output: { + assetModuleFilename: "images/file[ext]" + }, + module: { + generator: { + 'asset/resource': { + emit: false, + }, + }, + rules: [ + { + test: /\.png$/, + type: "asset/resource", + }, + { + test: /\.jpg$/, + type: "asset/resource" + } + ] + } +}; diff --git a/webpack-test/configCases/asset-modules/emit/test.filter.js b/webpack-test/configCases/asset-modules/emit/test.filter.js deleted file mode 100644 index 3be456dcd23..00000000000 --- a/webpack-test/configCases/asset-modules/emit/test.filter.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = () => {return false} \ No newline at end of file diff --git a/website/docs/en/config/module.mdx b/website/docs/en/config/module.mdx index b29b7f9625d..28c5fa3ccf1 100644 --- a/website/docs/en/config/module.mdx +++ b/website/docs/en/config/module.mdx @@ -375,6 +375,43 @@ module.exports = { }; ``` +#### module.generator.asset.emit + +- **Type:** `boolean` +- **Default:** `true` + +Whether to output assets to disk. You can set this option to `false` to avoid outputting unnecessary files for some scenarios such as SSR. + +Only for modules with module type `'asset'` or `'asset/resource'`. + +- `'asset'`: + +```js title=rspack.config.js +module.exports = { + module: { + generator: { + asset: { + emit: false, + }, + }, + }, +}; +``` + +- `'asset/resource'`: + +```js title=rspack.config.js +module.exports = { + module: { + generator: { + 'asset/resource': { + emit: false, + }, + }, + }, +}; +``` + ### module.generator["asset/inline"] Generator options for `asset/inline` modules. diff --git a/website/docs/zh/config/module.mdx b/website/docs/zh/config/module.mdx index 817e7a483b7..18f2f8c2761 100644 --- a/website/docs/zh/config/module.mdx +++ b/website/docs/zh/config/module.mdx @@ -375,6 +375,43 @@ module.exports = { }; ``` +#### module.generator.asset.emit + +- **类型:** `boolean` +- **默认值:** `true` + +是否将 asset 输出到磁盘。对于 SSR 等场景,你可以将该选项设置为 `false` 来避免输出无用的文件。 + +仅对模块类型为 `'asset'` 或 `'asset/resource'` 的模块生效。 + +- `'asset'`: + +```js title=rspack.config.js +module.exports = { + module: { + generator: { + asset: { + emit: false, + }, + }, + }, +}; +``` + +- `'asset/resource'`: + +```js title=rspack.config.js +module.exports = { + module: { + generator: { + 'asset/resource': { + emit: false, + }, + }, + }, +}; +``` + ### module.generator["asset/inline"] `asset/inline` 模块的生成器选项。 From a6841aab50542f4a577092baaed38db6f68bdca5 Mon Sep 17 00:00:00 2001 From: neverland Date: Tue, 16 Apr 2024 22:42:52 +0800 Subject: [PATCH 08/15] chore: update package manager of webpack-test README (#6257) --- .github/ISSUE_TEMPLATE/1-bug-report.en-US.yml | 4 ++-- webpack-examples/README.md | 6 +++--- webpack-test/README.md | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/1-bug-report.en-US.yml b/.github/ISSUE_TEMPLATE/1-bug-report.en-US.yml index 3e5eef83d24..a9cdb541011 100644 --- a/.github/ISSUE_TEMPLATE/1-bug-report.en-US.yml +++ b/.github/ISSUE_TEMPLATE/1-bug-report.en-US.yml @@ -47,7 +47,7 @@ body: description: Please provide the simplest steps so that we can quickly reproduce the problem. placeholder: | For example: - 1. run `yarn dev` - 2. `xxx` error occurred + 1. Run `npm run dev` + 2. Find some error messages validations: required: true diff --git a/webpack-examples/README.md b/webpack-examples/README.md index 9207ff0ae86..1ffb599ea2c 100644 --- a/webpack-examples/README.md +++ b/webpack-examples/README.md @@ -143,9 +143,9 @@ If you think an example is missing, please report it as issue. :) # Building an Example -1. Run `yarn` in the root of the project. -2. Run `yarn setup` in the root of the project. -3. Run `yarn add --dev webpack-cli` in the root of the project. +1. Run `pnpm i` in the root of the project. +2. Run `pnpm setup` in the root of the project. +3. Run `pnpm add --dev webpack-cli` in the root of the project. 4. Run `node build.js` in the specific example directory. (Ex: `cd examples/commonjs && node build.js`) Note: To build all examples run `npm run build:examples` diff --git a/webpack-test/README.md b/webpack-test/README.md index 468830ee795..365c90d0619 100644 --- a/webpack-test/README.md +++ b/webpack-test/README.md @@ -32,17 +32,17 @@ But don't give up hope!!! Although our tests may appear complex and overwhelming ## tl;dr Run all tests (this automatically runs the setup): ```sh -yarn test +pnpm test ``` Run an individual suite: ```sh -yarn jest ConfigTestCases +pnpm jest ConfigTestCases ``` Watch mode: ```sh -yarn jest --watch ConfigTestCases +pnpm jest --watch ConfigTestCases ``` See also: [Jest CLI docs](https://jestjs.io/docs/cli) From b23048d1f608d39cb337fed5b4ea0b29b56b6749 Mon Sep 17 00:00:00 2001 From: Zack Jackson Date: Tue, 16 Apr 2024 19:00:56 -0700 Subject: [PATCH 09/15] fix(core): update module federation runtime (#6247) * fix(core): update module federation runtime * test(core): update module federation unit tests * add patch * fix * fix * fix: containerShareScope should get value by shareScope key (#6248) * chore: every container should has unique name * fix: containerShareScope should get value by shareScope key --------- Co-authored-by: ScriptedAlchemy Co-authored-by: ahabhgk Co-authored-by: Hanric --- packages/rspack/package.json | 2 +- .../rspack/src/container/default.runtime.js | 7 +++-- .../container-1-5/2-container-full/index.js | 13 ++++++++ .../index.js | 12 ++++++++ pnpm-lock.yaml | 30 +++++++++---------- 5 files changed, 45 insertions(+), 19 deletions(-) diff --git a/packages/rspack/package.json b/packages/rspack/package.json index 554e1801e32..dd86c4ff74b 100644 --- a/packages/rspack/package.json +++ b/packages/rspack/package.json @@ -71,7 +71,7 @@ "wast-loader": "^1.11.4" }, "dependencies": { - "@module-federation/runtime-tools": "0.0.8", + "@module-federation/runtime-tools": "0.1.6", "@rspack/binding": "workspace:*", "browserslist": "^4.21.3", "enhanced-resolve": "5.12.0", diff --git a/packages/rspack/src/container/default.runtime.js b/packages/rspack/src/container/default.runtime.js index 0cb06ee4a52..6ca0e5d2119 100644 --- a/packages/rspack/src/container/default.runtime.js +++ b/packages/rspack/src/container/default.runtime.js @@ -42,7 +42,7 @@ module.exports = function () { const initializeSharingInitPromises = []; const initializeSharingInitTokens = []; const containerShareScope = - __webpack_require__.initializeExposesData?.containerShareScope; + __webpack_require__.initializeExposesData?.shareScope; early( __webpack_require__, @@ -91,10 +91,11 @@ module.exports = function () { for (let stage of stages) { if (typeof stage === "object" && stage !== null) { const { name, version, factory, eager } = stage; + const options = { version, scope: [scope], get: factory }; if (shared[name]) { - shared[name].scope.push(scope); + shared[name].push(options); } else { - shared[name] = { version, get: factory, scope: [scope] }; + shared[name] = [options]; } } } diff --git a/packages/rspack/tests/configCases/container-1-5/2-container-full/index.js b/packages/rspack/tests/configCases/container-1-5/2-container-full/index.js index d1e6224a7b4..e9d00676e5b 100644 --- a/packages/rspack/tests/configCases/container-1-5/2-container-full/index.js +++ b/packages/rspack/tests/configCases/container-1-5/2-container-full/index.js @@ -1,3 +1,16 @@ +// clean federation globals from previous executions +if (globalThis.__FEDERATION__) { + globalThis.__GLOBAL_LOADING_REMOTE_ENTRY__ = {}; + //@ts-ignore + globalThis.__FEDERATION__.__INSTANCES__.map((i) => { + i.moduleCache.clear(); + if (globalThis[i.name]) { + delete globalThis[i.name]; + } + }); + globalThis.__FEDERATION__.__INSTANCES__ = []; +} + let warnings = []; let oldWarn; diff --git a/packages/rspack/tests/configCases/container-1-5/module-federation-with-shareScope/index.js b/packages/rspack/tests/configCases/container-1-5/module-federation-with-shareScope/index.js index a44230f3c25..36214eb960c 100644 --- a/packages/rspack/tests/configCases/container-1-5/module-federation-with-shareScope/index.js +++ b/packages/rspack/tests/configCases/container-1-5/module-federation-with-shareScope/index.js @@ -1,3 +1,15 @@ +if (globalThis.__FEDERATION__) { + globalThis.__GLOBAL_LOADING_REMOTE_ENTRY__ = {}; + //@ts-ignore + globalThis.__FEDERATION__.__INSTANCES__.map((i) => { + i.moduleCache.clear(); + if (globalThis[i.name]) { + delete globalThis[i.name]; + } + }); + globalThis.__FEDERATION__.__INSTANCES__ = []; +} + it("should load the component from container", async () => { await __webpack_init_sharing__("test-scope"); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3238d6dc136..03173bda419 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -418,8 +418,8 @@ importers: packages/rspack: dependencies: '@module-federation/runtime-tools': - specifier: 0.0.8 - version: 0.0.8 + specifier: 0.1.6 + version: 0.1.6 '@rspack/binding': specifier: workspace:* version: link:../../crates/node_binding @@ -3251,28 +3251,28 @@ packages: resolution: {integrity: sha512-9b8mPpKrfeGRuhFH5iO1iwCLeIIsV6+H1sRfxbkoGXIyQE2BTsPd9zqSqQJ+pv5sJ/hT5M1zvOFL02MnEezFug==} dev: true - /@module-federation/runtime-tools@0.0.8: - resolution: {integrity: sha512-tqx3wlVHnpWLk+vn22c0x9Nv1BqdZnoS6vdMb53IsVpbQIFP70nhhvymHUyFuPkoLzMFidS7GpG58DYT/4lvCw==} + /@module-federation/runtime-tools@0.1.6: + resolution: {integrity: sha512-7ILVnzMIa0Dlc0Blck5tVZG1tnk1MmLnuZpLOMpbdW+zl+N6wdMjjHMjEZFCUAJh2E5XJ3BREwfX8Ets0nIkLg==} dependencies: - '@module-federation/runtime': 0.0.8 - '@module-federation/webpack-bundler-runtime': 0.0.8 + '@module-federation/runtime': 0.1.6 + '@module-federation/webpack-bundler-runtime': 0.1.6 dev: false - /@module-federation/runtime@0.0.8: - resolution: {integrity: sha512-Hi9g10aHxHdQ7CbchSvke07YegYwkf162XPOmixNmJr5Oy4wVa2d9yIVSrsWFhBRbbvM5iJP6GrSuEq6HFO3ug==} + /@module-federation/runtime@0.1.6: + resolution: {integrity: sha512-nj6a+yJ+QxmcE89qmrTl4lphBIoAds0PFPVGnqLRWflwAP88jrCcrrTqRhARegkFDL+wE9AE04+h6jzlbIfMKg==} dependencies: - '@module-federation/sdk': 0.0.8 + '@module-federation/sdk': 0.1.6 dev: false - /@module-federation/sdk@0.0.8: - resolution: {integrity: sha512-lkasywBItjUTNT0T0IskonDE2E/2tXE9UhUCPVoDL3NteDUSFGg4tpkF+cey1pD8mHh0XJcGrCuOW7s96peeAg==} + /@module-federation/sdk@0.1.6: + resolution: {integrity: sha512-qifXpyYLM7abUeEOIfv0oTkguZgRZuwh89YOAYIZJlkP6QbRG7DJMQvtM8X2yHXm9PTk0IYNnOJH0vNQCo6auQ==} dev: false - /@module-federation/webpack-bundler-runtime@0.0.8: - resolution: {integrity: sha512-ULwrTVzF47+6XnWybt6SIq97viEYJRv4P/DByw5h7PSX9PxSGyMm5pHfXdhcb7tno7VknL0t2V8F48fetVL9kA==} + /@module-federation/webpack-bundler-runtime@0.1.6: + resolution: {integrity: sha512-K5WhKZ4RVNaMEtfHsd/9CNCgGKB0ipbm/tgweNNeC11mEuBTNxJ09Y630vg3WPkKv9vfMCuXg2p2Dk+Q/KWTSA==} dependencies: - '@module-federation/runtime': 0.0.8 - '@module-federation/sdk': 0.0.8 + '@module-federation/runtime': 0.1.6 + '@module-federation/sdk': 0.1.6 dev: false /@monaco-editor/loader@1.4.0(monaco-editor@0.47.0): From 808ce2aba4b0886c2c8b243210b6d2cef8e9ec90 Mon Sep 17 00:00:00 2001 From: Cong-Cong Pan Date: Wed, 17 Apr 2024 11:44:23 +0800 Subject: [PATCH 10/15] feat: split lint-website ci (#6260) --- .github/workflows/ci.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a194a4cabc2..cd570bc8794 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -183,7 +183,17 @@ jobs: if: steps.changes.outputs.src == 'true' run: pnpm run format-ci:js - - name: Lint website + lint-website: + name: Lint and format website + runs-on: ubuntu-latest + needs: [check-changed] + steps: + - uses: actions/checkout@v4 + + - name: Pnpm Cache + uses: ./.github/actions/pnpm-cache + + - name: Run run: | cd website pnpm install From b0e1967cf800eb4e99ccbbe2c0badf110380f0fe Mon Sep 17 00:00:00 2001 From: neverland Date: Wed, 17 Apr 2024 12:57:57 +0800 Subject: [PATCH 11/15] docs: use PackageManagerTabs to display install commands (#6263) --- website/docs/en/guide/language-support.mdx | 30 +++------------------- website/docs/en/guide/react.mdx | 28 ++------------------ website/docs/en/guide/vue.mdx | 30 +++------------------- website/docs/zh/guide/language-support.mdx | 30 +++------------------- website/docs/zh/guide/react.mdx | 28 ++------------------ website/docs/zh/guide/vue.mdx | 30 +++------------------- 6 files changed, 16 insertions(+), 160 deletions(-) diff --git a/website/docs/en/guide/language-support.mdx b/website/docs/en/guide/language-support.mdx index 53462d1a613..fb2d9a558b3 100644 --- a/website/docs/en/guide/language-support.mdx +++ b/website/docs/en/guide/language-support.mdx @@ -1,3 +1,5 @@ +import { PackageManagerTabs } from '@theme'; + # Language support ## TypeScript @@ -199,33 +201,7 @@ Installing Tailwind CSS as a PostCSS plugin is the most seamless way to integrat Please install [tailwindcss](https://tailwindcss.com/),[autoprefixer](https://github.com/postcss/autoprefixer),[postcss](https://postcss.org/) and [postcss-loader](https://www.npmjs.com/package/) in your project. -import { Tabs, Tab } from '@theme'; - - - - -```sh -npm install -D tailwindcss autoprefixer postcss postcss-loader -``` - - - - - -```sh -yarn add -D tailwindcss autoprefixer postcss postcss-loader -``` - - - - - -```sh -pnpm install -D tailwindcss autoprefixer postcss postcss-loader -``` - - - + #### Configure Tailwind CSS diff --git a/website/docs/en/guide/react.mdx b/website/docs/en/guide/react.mdx index 4d7945f11cd..8f52c04a18e 100644 --- a/website/docs/en/guide/react.mdx +++ b/website/docs/en/guide/react.mdx @@ -1,4 +1,4 @@ -import { Tabs, Tab } from '@theme'; +import { PackageManagerTabs } from '@theme'; import { ApiMeta, Stability } from '../../../components/ApiMeta.tsx'; # React @@ -91,31 +91,7 @@ Recognizing this issue, we aim to gradually transition users to a more correct a First you need to install the dependencies: - - - -```sh -npm install -D @rspack/plugin-react-refresh react-refresh -``` - - - - - -```sh -yarn add -D @rspack/plugin-react-refresh react-refresh -``` - - - - - -```sh -pnpm install -D @rspack/plugin-react-refresh react-refresh -``` - - - + Enabling [React Fast Refresh](https://reactnative.dev/docs/fast-refresh) functionality primarily involves two aspects: code injection and code transformation. diff --git a/website/docs/en/guide/vue.mdx b/website/docs/en/guide/vue.mdx index 0afcbbcdfa3..2b6c6ce4b2c 100644 --- a/website/docs/en/guide/vue.mdx +++ b/website/docs/en/guide/vue.mdx @@ -1,3 +1,5 @@ +import { PackageManagerTabs } from '@theme'; + # Vue Vue is a very popular front-end framework, and you can start to use Vue with Rspack now. @@ -136,33 +138,7 @@ Since Rspack supports using `babel-loader`, you can directly use the [@vue/babel First, you need to install [babel-loader](https://www.npmjs.com/package/babel-loader), [@babel/core](https://www.npmjs.com/package/@babel/core) and [@vue/babel-plugin-jsx](https://www.npmjs.com/package/@vue/babel-plugin-jsx): -import { Tabs, Tab } from '@theme'; - - - - -```sh -npm install -D babel-loader @babel/core @vue/babel-plugin-jsx -``` - - - - - -```sh -yarn add -D babel-loader @babel/core @vue/babel-plugin-jsx -``` - - - - - -```sh -pnpm install -D babel-loader @babel/core @vue/babel-plugin-jsx -``` - - - + ### Configure diff --git a/website/docs/zh/guide/language-support.mdx b/website/docs/zh/guide/language-support.mdx index c36e5b78b30..7d942fcb848 100644 --- a/website/docs/zh/guide/language-support.mdx +++ b/website/docs/zh/guide/language-support.mdx @@ -1,3 +1,5 @@ +import { PackageManagerTabs } from '@theme'; + # 语言支持 ## TypeScript @@ -200,33 +202,7 @@ module.exports = { 在你的项目中安装 [tailwindcss](https://tailwindcss.com/)、[autoprefixer](https://github.com/postcss/autoprefixer)、[postcss](https://postcss.org/) 和 [postcss-loader](https://www.npmjs.com/package/postcss-loader) 这些依赖: -import { Tabs, Tab } from '@theme'; - - - - -```sh -npm install -D tailwindcss autoprefixer postcss postcss-loader -``` - - - - - -```sh -yarn add -D tailwindcss autoprefixer postcss postcss-loader -``` - - - - - -```sh -pnpm install -D tailwindcss autoprefixer postcss postcss-loader -``` - - - + #### 配置 Tailwind CSS diff --git a/website/docs/zh/guide/react.mdx b/website/docs/zh/guide/react.mdx index fff2a739273..65303ef1019 100644 --- a/website/docs/zh/guide/react.mdx +++ b/website/docs/zh/guide/react.mdx @@ -1,4 +1,4 @@ -import { Tabs, Tab } from '@theme'; +import { PackageManagerTabs } from '@theme'; import { ApiMeta, Stability } from '../../../components/ApiMeta.tsx'; # React @@ -93,31 +93,7 @@ export function Button({ children }) { 首先需要安装相关依赖: - - - -```sh -npm install -D @rspack/plugin-react-refresh react-refresh -``` - - - - - -```sh -yarn add -D @rspack/plugin-react-refresh react-refresh -``` - - - - - -```sh -pnpm install -D @rspack/plugin-react-refresh react-refresh -``` - - - + [React Fast Refresh](https://reactnative.dev/docs/fast-refresh) 功能的开启主要分为两部分:代码注入和代码转换 diff --git a/website/docs/zh/guide/vue.mdx b/website/docs/zh/guide/vue.mdx index 5c3cfd0d8b5..c6b8bed3b9e 100644 --- a/website/docs/zh/guide/vue.mdx +++ b/website/docs/zh/guide/vue.mdx @@ -1,3 +1,5 @@ +import { PackageManagerTabs } from '@theme'; + # Vue Vue 是一个非常流行的前端框架,现在你可以配合 Rspack 使用 Vue 的相关功能。 @@ -136,33 +138,7 @@ TypeScript 语法是通过 Rspack 内置的 `builtin:swc-loader` 进行支持的 首先,你需要安装 [babel-loader](https://www.npmjs.com/package/babel-loader)、[@babel/core](https://www.npmjs.com/package/@babel/core) 和 [@vue/babel-plugin-jsx](https://www.npmjs.com/package/@vue/babel-plugin-jsx): -import { Tabs, Tab } from '@theme'; - - - - -```sh -npm install -D babel-loader @babel/core @vue/babel-plugin-jsx -``` - - - - - -```sh -yarn add -D babel-loader @babel/core @vue/babel-plugin-jsx -``` - - - - - -```sh -pnpm install -D babel-loader @babel/core @vue/babel-plugin-jsx -``` - - - + ### 添加配置 From 7a406a8db8d4d9cec2e48112d39c02175686f025 Mon Sep 17 00:00:00 2001 From: Cong-Cong Pan Date: Wed, 17 Apr 2024 13:00:06 +0800 Subject: [PATCH 12/15] docs: update DefinePlugin docs (#6259) * docs: update DefinePlugin en docs * docs: update DefinePlugin zh docs --- .../docs/en/plugins/webpack/define-plugin.mdx | 112 +++++++++++++----- .../docs/zh/plugins/webpack/define-plugin.mdx | 112 +++++++++++++----- 2 files changed, 162 insertions(+), 62 deletions(-) diff --git a/website/docs/en/plugins/webpack/define-plugin.mdx b/website/docs/en/plugins/webpack/define-plugin.mdx index 177ab7c780e..a7f93380aae 100644 --- a/website/docs/en/plugins/webpack/define-plugin.mdx +++ b/website/docs/en/plugins/webpack/define-plugin.mdx @@ -1,55 +1,105 @@ import { ApiMeta } from '../../../../components/ApiMeta.tsx'; +import WebpackLicense from '../../../../components/webpack-license'; + + # DefinePlugin -This plugin will replace variables in the code with other values or expressions at compile time. +The `DefinePlugin` replaces variables in your code with other values or expressions at compile time. This can be useful for allowing different behavior between development builds and production builds. If you perform logging in your development build but not in the production build you might use a global constant to determine whether logging takes place. That's where `DefinePlugin` shines, set it and forget it rules for development and production builds. ```js -new rspack.DefinePlugin(options); +new rspack.DefinePlugin({ + // Definitions... +}); ``` -- options - - **Type:** `Record` +## Options + +- **Type:** `Record` + +## Examples + +### Basic Use Case + +Each key passed into `DefinePlugin` is an identifier or multiple identifiers joined with `.`. + +- If the value is a string it will be used as a code fragment. +- If the value isn't a string, it will be stringified (including functions). +- If the value is an object all keys are defined the same way. +- If you prefix `typeof` to the key, it's only defined for typeof calls. + +The values will be inlined into the code allowing a minification pass to remove the redundant conditional. -When using the following configuration: +```js +new rspack.DefinePlugin({ + PRODUCTION: JSON.stringify(true), + VERSION: JSON.stringify('5fa3b9'), + BROWSER_SUPPORTS_HTML5: true, + TWO: '1+1', + 'typeof window': JSON.stringify('object'), + 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV), +}); +``` -```ts title="rspack.config.js" -const rspack = require('@rspack/core'); -module.exports = { - plugins: [ - new rspack.DefinePlugin({ - 'process.env.NODE_ENV': "'development'", - TRUE: true, - TRUE_STRING: 'true', - UNDEFINED: undefined, - UNDEFINED_STRING: 'undefined', - }), - ], -}; +```js +console.log('Running App version ' + VERSION); +if (!BROWSER_SUPPORTS_HTML5) require('html5shiv'); ``` -Input: +:::warning +When defining values for `process` prefer `'process.env.NODE_ENV': JSON.stringify('production')` over `process: { env: { NODE_ENV: JSON.stringify('production') } }`. Using the latter will overwrite the `process` object which can break compatibility with some modules that expect other values on the process object to be defined. +::: + +:::tip +Note that because the plugin does a direct text replacement, the value given to it must include **actual quotes** inside of the string itself. Typically, this is done either with alternate quotes, such as `'"production"'`, or by using `JSON.stringify('production')`. +::: -```ts -if (process.env.NODE_ENV === 'development') { - console.log('run in development mode'); +```js +if (!PRODUCTION) { + console.log('Debug info'); } -console.log(TRUE === TRUE_STRING); -console.log(UNDEFINED === UNDEFINED_STRING); +if (PRODUCTION) { + console.log('Production log'); +} ``` -Output: +After passing through Rspack with no minification results in: -```ts -if ('development' === 'development') { - console.log('run in development mode'); +```js +if (!true) { + console.log('Debug info'); } +if (true) { + console.log('Production log'); +} +``` + +and then after a minification pass results in: + +```js +console.log('Production log'); +``` + +### Feature Flags -fetch('/api/test'); +Enable/disable features in production/development build using [feature flags](https://en.wikipedia.org/wiki/Feature_toggle). -console.log(true === true); -console.log(undefined === undefined); +```js +new rspack.DefinePlugin({ + NICE_FEATURE: JSON.stringify(true), + EXPERIMENTAL_FEATURE: JSON.stringify(false), +}); +``` + +### Service URLs + +Use a different service URL in production/development builds: + +```js +new rspack.DefinePlugin({ + SERVICE_URL: JSON.stringify('https://dev.example.com'), +}); ``` diff --git a/website/docs/zh/plugins/webpack/define-plugin.mdx b/website/docs/zh/plugins/webpack/define-plugin.mdx index 17650d82e69..1bce6d6529d 100644 --- a/website/docs/zh/plugins/webpack/define-plugin.mdx +++ b/website/docs/zh/plugins/webpack/define-plugin.mdx @@ -1,55 +1,105 @@ import { ApiMeta } from '../../../../components/ApiMeta.tsx'; +import WebpackLicense from '../../../../components/webpack-license'; + + # DefinePlugin -此插件将会在编译时将代码中的变量替换为其他值或表达式。 +`DefinePlugin` 在编译时将代码中的变量替换为其他值或表达式。这对于允许开发构建和生产构建之间的不同行为非常有用。如果你在开发构建中执行日志记录,但在生产构建中则不执行,你可能会使用一个全局常量来决定是否进行日志记录。这正是 `DefinePlugin` 的用武之地,为开发和生产构建设置一成不变的规则。 ```js -new rspack.DefinePlugin(options); +new rspack.DefinePlugin({ + // 定义... +}); ``` -- options - - **类型:** `Record` +## 选项 + +- **类型:** `Record` + +## 示例 + +### 基本使用 + +传入 `DefinePlugin` 的每个键都是一个标识符或多个标识符用 `.` 连接。 + +- 如果值是一个字符串,它将被用作代码片段。 +- 如果值不是字符串,它会被转化为字符串(包括函数)。 +- 如果值是一个对象,所有键都以相同的方式定义。 +- 如果你在键前加上 `typeof`,它只在 typeof 调用中被定义。 + +这些值将被内联到代码中,允许在压缩阶段删除掉那些冗余的条件判断。 -当使用以下配置时: +```js +new rspack.DefinePlugin({ + PRODUCTION: JSON.stringify(true), + VERSION: JSON.stringify('5fa3b9'), + BROWSER_SUPPORTS_HTML5: true, + TWO: '1+1', + 'typeof window': JSON.stringify('object'), + 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV), +}); +``` -```ts title="rspack.config.js" -const rspack = require('@rspack/core'); -module.exports = { - plugins: [ - new rspack.DefinePlugin({ - 'process.env.NODE_ENV': "'development'", - TRUE: true, - TRUE_STRING: 'true', - UNDEFINED: undefined, - UNDEFINED_STRING: 'undefined', - }), - ], -}; +```js +console.log('Running App version ' + VERSION); +if (!BROWSER_SUPPORTS_HTML5) require('html5shiv'); ``` -输入代码: +:::warning 警告 +在为 `process` 定义值时,推荐使用 `'process.env.NODE_ENV': JSON.stringify('production')` 而不是 `process: { env: { NODE_ENV: JSON.stringify('production') } }`。使用后者会重写 `process` 对象,这可能会破坏对某些模块的兼容性,这些模块期望 process 对象上的其他值被定义。 +::: + +:::tip 提示 +请注意,由于插件直接执行文本替换,因此提供给它的值必须包含字符串内部的实际引号。通常,这是通过使用交替引号,如 `'"production"'`,或使用 `JSON.stringify('production')` 来完成。 +::: -```ts -if (process.env.NODE_ENV === 'development') { - console.log('run in development mode'); +```js +if (!PRODUCTION) { + console.log('Debug info'); } -console.log(TRUE === TRUE_STRING); -console.log(UNDEFINED === UNDEFINED_STRING); +if (PRODUCTION) { + console.log('Production log'); +} ``` -输出代码: +通过 Rspack,但不进行压缩后的结果为: -```ts -if ('development' === 'development') { - console.log('run in development mode'); +```js +if (!true) { + console.log('Debug info'); } +if (true) { + console.log('Production log'); +} +``` + +在压缩后的结果为: + +```js +console.log('Production log'); +``` + +### 特性标志 -fetch('/api/test'); +使用[特性标志](https://en.wikipedia.org/wiki/Feature_toggle)在生产/开发构建中启用/禁用功能。 -console.log(true === true); -console.log(undefined === undefined); +```js +new rspack.DefinePlugin({ + NICE_FEATURE: JSON.stringify(true), + EXPERIMENTAL_FEATURE: JSON.stringify(false), +}); +``` + +### 服务 URL + +在生产/开发构建中使用不同的服务 URL: + +```js +new rspack.DefinePlugin({ + SERVICE_URL: JSON.stringify('https://dev.example.com'), +}); ``` From 68ffd484d12d42e54450278e0b63ba242a90043f Mon Sep 17 00:00:00 2001 From: Cong-Cong Pan Date: Wed, 17 Apr 2024 13:00:38 +0800 Subject: [PATCH 13/15] docs: update ProvidePlugin docs (#6261) * docs: update ProvidePlugin zh * docs: update ProvidePlugin en --- .../en/plugins/webpack/provide-plugin.mdx | 98 ++++++++++++++++--- .../zh/plugins/webpack/provide-plugin.mdx | 98 ++++++++++++++++--- 2 files changed, 166 insertions(+), 30 deletions(-) diff --git a/website/docs/en/plugins/webpack/provide-plugin.mdx b/website/docs/en/plugins/webpack/provide-plugin.mdx index 900eff24ad9..fc71fb7b7a8 100644 --- a/website/docs/en/plugins/webpack/provide-plugin.mdx +++ b/website/docs/en/plugins/webpack/provide-plugin.mdx @@ -1,40 +1,108 @@ import { ApiMeta } from '../../../../components/ApiMeta.tsx'; +import WebpackLicense from '../../../../components/webpack-license'; + + # ProvidePlugin -This plugin will automatically load modules instead of having to import or require them everywhere. +Automatically load modules instead of having to `import` or `require` them everywhere. + +```js +new rspack.ProvidePlugin({ + identifier: 'module1', + // ... +}); +``` + +or ```js -new rspack.ProvidePlugin(options); +new rspack.ProvidePlugin({ + identifier: ['module1', 'property1'], + // ... +}); ``` -- options - - **Type:** `Record` +By default, module resolution path is current folder (`./**`) and `node_modules`. -When using the following configuration: +It is also possible to specify full path: ```js -const rspack = require('@rspack/core'); -module.exports = { - plugins: [ - new rspack.ProvidePlugin({ - process: [require.resolve('process/browser')], - }), - ], -}; +const path = require('path'); + +new rspack.ProvidePlugin({ + identifier: path.resolve(path.join(__dirname, 'src/module1')), + // ... +}); ``` -Which will convert the following code: +Whenever the `identifier` is encountered as free variable in a module, the `module` is loaded automatically and the `identifier` is filled with the exports of the loaded `module` (or `property` in order to support named exports). + +For importing the default export of an ES2015 module, you have to specify the default property of module. + +## Options + +- **Type:** `Record` + +## Examples + +### Using process in the Browser + +Enable `process` object support within a browser context. + +```js +new rspack.ProvidePlugin({ + process: [require.resolve('process/browser')], +}); +``` + +the piece of code: ```js console.log(process.version); ``` -To: +will be transformed behind the scenes to: ```js import process from 'process/browser'; console.log(process.version); ``` + +### jQuery + +To automatically load `jquery` we can point both variables it exposes to the corresponding node module: + +```js +new rspack.ProvidePlugin({ + $: 'jquery', + jQuery: 'jquery', +}); +``` + +Then in any of our source code: + +```js +// in a module +$('#item'); // <= works +jQuery('#item'); // <= also works +// $ is automatically set to the exports of module "jquery" +``` + +### Lodash Map + +```js +new rspack.ProvidePlugin({ + _map: ['lodash', 'map'], +}); +``` + +### Vue.js + +```js +new rspack.ProvidePlugin({ + Vue: ['vue/dist/vue.esm.js', 'default'], +}); +``` diff --git a/website/docs/zh/plugins/webpack/provide-plugin.mdx b/website/docs/zh/plugins/webpack/provide-plugin.mdx index 8589703e970..26d2f3ba78e 100644 --- a/website/docs/zh/plugins/webpack/provide-plugin.mdx +++ b/website/docs/zh/plugins/webpack/provide-plugin.mdx @@ -1,40 +1,108 @@ import { ApiMeta } from '../../../../components/ApiMeta.tsx'; +import WebpackLicense from '../../../../components/webpack-license'; + + # ProvidePlugin -此插件会自动的将全局变量转换为模块导入。 +自动加载模块,而不必在每处都 `import` 或 `require` 它们。 + +```js +new rspack.ProvidePlugin({ + identifier: 'module1', + // ... +}); +``` + +或 ```js -new rspack.ProvidePlugin(options); +new rspack.ProvidePlugin({ + identifier: ['module1', 'property1'], + // ... +}); ``` -- options - - **类型:** `Record` +默认情况下,模块解析路径为当前文件夹(`./**`)和 `node_modules`。 -如下配置: +也可以指定完整路径: ```js -const rspack = require('@rspack/core'); -module.exports = { - plugins: [ - new rspack.ProvidePlugin({ - process: [require.resolve('process/browser')], - }), - ], -}; +const path = require('path'); + +new rspack.ProvidePlugin({ + identifier: path.resolve(path.join(__dirname, 'src/module1')), + // ... +}); ``` -将如下代码: +每当在模块中遇到 `identifier` 作为自由变量时,相应的`模块`会自动加载,且 `identifier` 会被填充为已加载`模块`的输出(或者是`属性`,以支持具名导出)。 + +为了导入一个 ES2015 模块的默认导出,你必须指定模块的 default 属性。 + +## 选项 + +- **类型:** `Record` + +## 示例 + +### 在浏览器中使用 process 对象 + +在浏览器环境中启用 process 对象的支持。 + +```js +new rspack.ProvidePlugin({ + process: [require.resolve('process/browser')], +}); +``` + +以下代码片段: ```js console.log(process.version); ``` -转换为: +将被转换为: ```js import process from 'process/browser'; console.log(process.version); ``` + +### jQuery + +要自动加载 jquery,我们可以把它暴露的两个变量都对应到相应的模块: + +```js +new rspack.ProvidePlugin({ + $: 'jquery', + jQuery: 'jquery', +}); +``` + +然后在我们的任何源代码中: + +```js +// 在一个模块中 +$('#item'); // <= 可以工作 +jQuery('#item'); // <= 也可以工作 +// $ 被自动设置为模块 "jquery" 的导出 +``` + +### Lodash Map + +```js +new rspack.ProvidePlugin({ + _map: ['lodash', 'map'], +}); +``` + +### Vue.js + +```js +new rspack.ProvidePlugin({ + Vue: ['vue/dist/vue.esm.js', 'default'], +}); +``` From 7cc39cc4bb6f73791a5bcb175137ffd84b105da5 Mon Sep 17 00:00:00 2001 From: Cong-Cong Pan Date: Wed, 17 Apr 2024 13:01:13 +0800 Subject: [PATCH 14/15] docs: update SourceMapDevToolPlugin docs (#6262) * docs: update SourceMapDevToolPlugin zh * docs: update SourceMapDevToolPlugin en --- .../webpack/source-map-dev-tool-plugin.mdx | 18 +++++++--- .../webpack/source-map-dev-tool-plugin.mdx | 34 ++++++++++++------- 2 files changed, 35 insertions(+), 17 deletions(-) diff --git a/website/docs/en/plugins/webpack/source-map-dev-tool-plugin.mdx b/website/docs/en/plugins/webpack/source-map-dev-tool-plugin.mdx index 3754ae3c16b..554339ee09f 100644 --- a/website/docs/en/plugins/webpack/source-map-dev-tool-plugin.mdx +++ b/website/docs/en/plugins/webpack/source-map-dev-tool-plugin.mdx @@ -12,20 +12,28 @@ new rspack.SourceMapDevToolPlugin(options); ## Options -- `test` (`string` `RegExp` `[string, RegExp]`): Include source maps for modules based on their extension (defaults to .js, .mjs, and .css). +- `test` (`string` `RegExp` `[string, RegExp]`): Include source maps for modules based on their extension (defaults to `.js`, `.mjs`, and `.css`). - `include` (`string` `RegExp` `[string, RegExp]`): Include source maps for module paths that match the given value. - `exclude` (`string` `RegExp` `[string, RegExp]`): Exclude modules that match the given value from source map generation. - `filename` (`string`): Defines the output filename of the SourceMap (will be inlined if no value is provided). -- `append` (`string` `function`): Appends the given value to the original asset. Usually the #sourceMappingURL comment. [url] is replaced with a URL to the source map file. Path parameters are supported: [chunk], [filename] and [contenthash]. Setting append to false disables the appending. +- `append` (`string` `function`): Appends the given value to the original asset. Usually the `#sourceMappingURL` comment. `[url]` is replaced with a URL to the source map file. Path parameters are supported: `[chunk]`, `[filename]` and `[contenthash]`. Setting append to false disables the appending. - `moduleFilenameTemplate` (`string`): See [`output.devtoolModuleFilenameTemplate`](/en/config/output.html#outputdevtoolmodulefilenametemplate). - `fallbackModuleFilenameTemplate` (`string`): See link above. - `namespace` (`string`): See [`output.devtoolNamespace`](/en/config/output.html#outputdevtoolnamespace). - `module = true` (`boolean`): Indicates whether loaders should generate source maps. - `columns = true` (`boolean`): Indicates whether column mappings should be used. - `noSources = false` (`boolean`): Prevents the source file content from being included in the source map. -- `publicPath` (`string`): Emits absolute URLs with public path prefix, e.g. https://example.com/project/. -- `fileContext` (`string`): Makes the [file] argument relative to this directory. -- `sourceRoot` (`string`): Provide a custom value for the sourceRoot property in the SourceMap. +- `publicPath` (`string`): Emits absolute URLs with public path prefix, e.g. `https://example.com/project/`. +- `fileContext` (`string`): Makes the `[file]` argument relative to this directory. +- `sourceRoot` (`string`): Provide a custom value for the `sourceRoot` property in the SourceMap. + +:::tip +Setting `module` and/or `columns` to `false` will yield less accurate source maps but will also improve compilation performance significantly. +::: + +:::tip +If you want to use a custom configuration for this plugin in [development mode](/config/mode#development), make sure to disable the default one. I.e. set `devtool: false`. +::: ## Examples diff --git a/website/docs/zh/plugins/webpack/source-map-dev-tool-plugin.mdx b/website/docs/zh/plugins/webpack/source-map-dev-tool-plugin.mdx index 21c6da0956b..74957c981f3 100644 --- a/website/docs/zh/plugins/webpack/source-map-dev-tool-plugin.mdx +++ b/website/docs/zh/plugins/webpack/source-map-dev-tool-plugin.mdx @@ -10,24 +10,34 @@ import { ApiMeta } from '../../../../components/ApiMeta.tsx'; new rspack.SourceMapDevToolPlugin(options); ``` -## 配置项 +## 选项 -支持以下配置项: +支持以下选项: -- `test` (`string` `RegExp` `[string, RegExp]`):包含基于扩展名的模块的 source map(默认是 .js, .mjs 和 .css)。 +- `test` (`string` `RegExp` `[string, RegExp]`):根据模块扩展名,匹配的生成 source map(默认是 `.js`, `.mjs` 和 `.css`)。 - `include` (`string` `RegExp` `[string, RegExp]`):使路径与该值匹配的模块生成 source map。 - `exclude` (`string` `RegExp` `[string, RegExp]`):使匹配该值的模块不生成 source map。 -- `filename` (`string`):定义生成的 SourceMap 的名称(不设置将默认置为 inlined)。 -- `append` (`string` `function`):在原始资源后追加给定值。通常是 #sourceMappingURL 注释。[url] 被替换成 source map 文件的 URL。支持 path 参数:[chunk]、[filename] 和 [contenthash]。设置 append 为 false 会禁止追加。 -- `moduleFilenameTemplate(string)`:详见 [`output.devtoolModuleFilenameTemplate`](/zh/config/output.html#outputdevtoolmodulefilenametemplate)。 +- `filename` (`string`):定义生成的 source map 的名称(如果未提供值,则内联)。 +- `append` (`string` `function`):原始资源后追加给定值。通常是 `#sourceMappingURL` 注释。`[url]` 被替换成 source map 文件的 URL。支持路径参数:`[chunk]`、`[filename]` 和 `[contenthash]`。将 `append` 设置为 `false` 可禁用附加操作。 +- `moduleFilenameTemplate`(`string`):详见 [`output.devtoolModuleFilenameTemplate`](/zh/config/output.html#outputdevtoolmodulefilenametemplate)。 - `fallbackModuleFilenameTemplate` (`string`):详见上面的链接。 - `namespace` (`string`):详见 [`output.devtoolNamespace`](/zh/config/output.html#outputdevtoolnamespace). -- `module = true` (`boolean`):表示 loader 是否生成 source map。 -- `columns = true` (`boolean`):表示是否应该使用 column mapping。 -- `noSources = false` (`boolean`):防止源文件的内容被包含在 source map 中。 -- `publicPath` (`string`):生成带 public path 前缀的绝对 URL,例如:https://example.com/project/。 -- `fileContext` (`string`):使得 [file] 参数作为本目录的相对路径。 -- `sourceRoot` (`string`):给 SourceMap 中的 sourceRoot 属性提供一个自定义值。 +- `module = true` (`boolean`):指示 loader 是否应该生成 source map 文件。 +- `columns = true` (`boolean`):指示是否使用 column mapping。 +- `noSources = false` (`boolean`):阻止源文件内容被包含在 source map 中。 +- `publicPath` (`string`):使用公共路径前缀生成绝对 URL,例如 `https://example.com/project/`。 +- `fileContext` (`string`):使 `[file]` 参数相对于这个目录。 +- `sourceRoot` (`string`):为 source map 中的 `sourceRoot` 属性提供自定义值。 + +`fileContext` 选项在你希望将 source map 存储在上级目录以避免绝对 `[url]` 中出现 `../../` 时非常有用。 + +:::tip 提示 +将 `module` 或 `columns` 设置为 `false` 将生成不太准确的 source map,但同时也能显著提高编译性能。 +::: + +:::tip 提示 +如果你想要在[开发模式](/config/mode#development)中为这个插件使用自定义配置,请确保禁用默认配置。即设置 `devtool: false`。 +::: ## 示例 From e04371b407ebb94bc64c4c7ebc28e0d22c5a4aba Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 17 Apr 2024 13:57:49 +0800 Subject: [PATCH 15/15] Release Packages:0.6.2 (#6246) Reelase Packages:0.6.2 Co-authored-by: github-actions[bot] Co-authored-by: Fy <1114550440@qq.com> Co-authored-by: Gengkun --- crates/node_binding/package.json | 2 +- npm/darwin-arm64/package.json | 2 +- npm/darwin-x64/package.json | 2 +- npm/linux-x64-gnu/package.json | 2 +- npm/win32-x64-msvc/package.json | 2 +- package.json | 2 +- packages/create-rspack/package.json | 2 +- packages/rspack-cli/package.json | 2 +- packages/rspack-dev-server/package.json | 2 +- packages/rspack-plugin-minify/package.json | 2 +- packages/rspack-plugin-react-refresh/package.json | 2 +- packages/rspack-test-tools/package.json | 2 +- packages/rspack/package.json | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/crates/node_binding/package.json b/crates/node_binding/package.json index d5c2ec5e779..b5885fe617d 100644 --- a/crates/node_binding/package.json +++ b/crates/node_binding/package.json @@ -1,6 +1,6 @@ { "name": "@rspack/binding", - "version": "0.6.1", + "version": "0.6.2", "license": "MIT", "description": "Node binding for rspack", "main": "binding.js", diff --git a/npm/darwin-arm64/package.json b/npm/darwin-arm64/package.json index 642c99965cc..5a8ed4674b6 100644 --- a/npm/darwin-arm64/package.json +++ b/npm/darwin-arm64/package.json @@ -1,6 +1,6 @@ { "name": "@rspack/binding-darwin-arm64", - "version": "0.6.1", + "version": "0.6.2", "license": "MIT", "description": "Node binding for rspack", "main": "rspack.darwin-arm64.node", diff --git a/npm/darwin-x64/package.json b/npm/darwin-x64/package.json index c47b1fa1cc6..e37b842534f 100644 --- a/npm/darwin-x64/package.json +++ b/npm/darwin-x64/package.json @@ -1,6 +1,6 @@ { "name": "@rspack/binding-darwin-x64", - "version": "0.6.1", + "version": "0.6.2", "license": "MIT", "description": "Node binding for rspack", "main": "rspack.darwin-x64.node", diff --git a/npm/linux-x64-gnu/package.json b/npm/linux-x64-gnu/package.json index 70a96575a4d..2c5588e01fb 100644 --- a/npm/linux-x64-gnu/package.json +++ b/npm/linux-x64-gnu/package.json @@ -1,6 +1,6 @@ { "name": "@rspack/binding-linux-x64-gnu", - "version": "0.6.1", + "version": "0.6.2", "license": "MIT", "description": "Node binding for rspack", "main": "rspack.linux-x64-gnu.node", diff --git a/npm/win32-x64-msvc/package.json b/npm/win32-x64-msvc/package.json index 95f1a206bc5..e076f94a085 100644 --- a/npm/win32-x64-msvc/package.json +++ b/npm/win32-x64-msvc/package.json @@ -1,6 +1,6 @@ { "name": "@rspack/binding-win32-x64-msvc", - "version": "0.6.1", + "version": "0.6.2", "license": "MIT", "description": "Node binding for rspack", "main": "rspack.win32-x64-msvc.node", diff --git a/package.json b/package.json index 92257416b43..5598cd9dfbc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "monorepo", - "version": "0.6.1", + "version": "0.6.2", "license": "MIT", "description": "A Fast Rust-based web bundler", "private": true, diff --git a/packages/create-rspack/package.json b/packages/create-rspack/package.json index 633af4668cd..60579f725ca 100644 --- a/packages/create-rspack/package.json +++ b/packages/create-rspack/package.json @@ -1,6 +1,6 @@ { "name": "create-rspack", - "version": "0.6.1", + "version": "0.6.2", "license": "MIT", "main": "index.js", "bin": { diff --git a/packages/rspack-cli/package.json b/packages/rspack-cli/package.json index b64914e297d..8f0f6acc22a 100644 --- a/packages/rspack-cli/package.json +++ b/packages/rspack-cli/package.json @@ -1,6 +1,6 @@ { "name": "@rspack/cli", - "version": "0.6.1", + "version": "0.6.2", "license": "MIT", "description": "CLI for rspack", "bin": { diff --git a/packages/rspack-dev-server/package.json b/packages/rspack-dev-server/package.json index 7869711f7a3..d3558806416 100644 --- a/packages/rspack-dev-server/package.json +++ b/packages/rspack-dev-server/package.json @@ -1,6 +1,6 @@ { "name": "@rspack/dev-server", - "version": "0.6.1", + "version": "0.6.2", "license": "MIT", "description": "Development server for rspack", "main": "./dist/index.js", diff --git a/packages/rspack-plugin-minify/package.json b/packages/rspack-plugin-minify/package.json index 4a5dd7c4322..b93f8e761ca 100644 --- a/packages/rspack-plugin-minify/package.json +++ b/packages/rspack-plugin-minify/package.json @@ -1,6 +1,6 @@ { "name": "@rspack/plugin-minify", - "version": "0.6.1", + "version": "0.6.2", "license": "MIT", "description": "Minify plugin for rspack", "main": "src/index.js", diff --git a/packages/rspack-plugin-react-refresh/package.json b/packages/rspack-plugin-react-refresh/package.json index c50c204d0e7..bfc2da7402c 100644 --- a/packages/rspack-plugin-react-refresh/package.json +++ b/packages/rspack-plugin-react-refresh/package.json @@ -1,6 +1,6 @@ { "name": "@rspack/plugin-react-refresh", - "version": "0.6.1", + "version": "0.6.2", "license": "MIT", "description": "React refresh plugin for rspack", "main": "dist/index.js", diff --git a/packages/rspack-test-tools/package.json b/packages/rspack-test-tools/package.json index 66e16ed0b7b..70b1d27b3c8 100644 --- a/packages/rspack-test-tools/package.json +++ b/packages/rspack-test-tools/package.json @@ -1,6 +1,6 @@ { "name": "@rspack/test-tools", - "version": "0.6.1", + "version": "0.6.2", "license": "MIT", "description": "Test tools for rspack", "main": "dist/index.js", diff --git a/packages/rspack/package.json b/packages/rspack/package.json index dd86c4ff74b..9bf138d51ca 100644 --- a/packages/rspack/package.json +++ b/packages/rspack/package.json @@ -1,6 +1,6 @@ { "name": "@rspack/core", - "version": "0.6.1", + "version": "0.6.2", "webpackVersion": "5.75.0", "license": "MIT", "description": "A Fast Rust-based Web Bundler",