@rsbuild/webpack 0.0.9 → 0.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/compiled/webpack-manifest-plugin/types/helpers.d.ts +1 -1
  2. package/compiled/webpack-manifest-plugin/types/hooks.d.ts +1 -1
  3. package/dist/config/defaults.js +1 -4
  4. package/dist/core/createContext.js +0 -4
  5. package/dist/core/devMiddleware.js +6 -6
  6. package/dist/core/initConfigs.d.ts +2 -2
  7. package/dist/core/initConfigs.js +1 -2
  8. package/dist/core/webpackConfig.js +7 -8
  9. package/dist/plugins/babel.js +5 -11
  10. package/dist/plugins/minimize.js +5 -2
  11. package/dist/plugins/moduleScopes.d.ts +2 -2
  12. package/dist/plugins/react.d.ts +2 -0
  13. package/dist/plugins/react.js +96 -0
  14. package/dist/plugins/tsLoader.js +54 -56
  15. package/dist/shared/plugin.js +1 -2
  16. package/dist/types/config/index.d.ts +6 -14
  17. package/dist/types/config/index.js +0 -10
  18. package/dist/types/config/security.d.ts +3 -3
  19. package/dist/types/config/source.d.ts +4 -13
  20. package/dist/types/config/tools.d.ts +15 -18
  21. package/dist/types/context.d.ts +0 -2
  22. package/dist/types/hooks.d.ts +7 -2
  23. package/dist/types/thirdParty/index.d.ts +0 -2
  24. package/package.json +32 -29
  25. package/dist/config/validate/dev.d.ts +0 -3
  26. package/dist/config/validate/dev.js +0 -29
  27. package/dist/config/validate/experiments.d.ts +0 -3
  28. package/dist/config/validate/experiments.js +0 -29
  29. package/dist/config/validate/html.d.ts +0 -3
  30. package/dist/config/validate/html.js +0 -29
  31. package/dist/config/validate/index.d.ts +0 -4
  32. package/dist/config/validate/index.js +0 -52
  33. package/dist/config/validate/output.d.ts +0 -3
  34. package/dist/config/validate/output.js +0 -37
  35. package/dist/config/validate/performance.d.ts +0 -3
  36. package/dist/config/validate/performance.js +0 -47
  37. package/dist/config/validate/security.d.ts +0 -4
  38. package/dist/config/validate/security.js +0 -38
  39. package/dist/config/validate/source.d.ts +0 -3
  40. package/dist/config/validate/source.js +0 -34
  41. package/dist/config/validate/tools.d.ts +0 -3
  42. package/dist/config/validate/tools.js +0 -57
  43. package/dist/exports/HtmlWebpackPlugin.d.ts +0 -2
  44. package/dist/exports/HtmlWebpackPlugin.js +0 -35
  45. package/dist/plugins/pug.d.ts +0 -2
  46. package/dist/plugins/pug.js +0 -52
  47. package/dist/types/config/dev.d.ts +0 -3
  48. package/dist/types/config/dev.js +0 -16
  49. package/dist/types/config/experiments.d.ts +0 -3
  50. package/dist/types/config/experiments.js +0 -16
  51. package/dist/types/config/html.d.ts +0 -3
  52. package/dist/types/config/html.js +0 -16
  53. package/dist/types/config/output.d.ts +0 -9
  54. package/dist/types/config/output.js +0 -16
  55. package/dist/types/config/performance.d.ts +0 -3
  56. package/dist/types/config/performance.js +0 -16
  57. package/dist/types/thirdParty/CopyWebpackPlugin.d.ts +0 -62
  58. package/dist/types/thirdParty/CopyWebpackPlugin.js +0 -16
  59. package/dist/webpackLoaders/pugLoader.d.ts +0 -3
  60. package/dist/webpackLoaders/pugLoader.js +0 -44
@@ -1,2 +0,0 @@
1
- import type { RsbuildPlugin } from '../types';
2
- export declare const pluginPug: () => RsbuildPlugin;
@@ -1,52 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var pug_exports = {};
30
- __export(pug_exports, {
31
- pluginPug: () => pluginPug
32
- });
33
- module.exports = __toCommonJS(pug_exports);
34
- var import_path = __toESM(require("path"));
35
- var import_shared = require("@rsbuild/shared");
36
- const pluginPug = () => ({
37
- name: "plugin-pug",
38
- setup(api) {
39
- api.modifyWebpackChain(async (chain, { CHAIN_ID }) => {
40
- const config = api.getNormalizedConfig();
41
- const { pug } = config.tools;
42
- if (!pug) {
43
- return;
44
- }
45
- chain.module.rule(CHAIN_ID.RULE.PUG).test(/\.pug$/).use(CHAIN_ID.USE.PUG).loader(import_path.default.resolve(__dirname, "../webpackLoaders/pugLoader")).options((0, import_shared.mergeChainedOptions)({}, pug === true ? {} : pug));
46
- });
47
- }
48
- });
49
- // Annotate the CommonJS export names for ESM import in node:
50
- 0 && (module.exports = {
51
- pluginPug
52
- });
@@ -1,3 +0,0 @@
1
- import type { SharedDevConfig, NormalizedSharedDevConfig } from '@rsbuild/shared';
2
- export type DevConfig = SharedDevConfig;
3
- export type NormalizedDevConfig = NormalizedSharedDevConfig;
@@ -1,16 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __copyProps = (to, from, except, desc) => {
7
- if (from && typeof from === "object" || typeof from === "function") {
8
- for (let key of __getOwnPropNames(from))
9
- if (!__hasOwnProp.call(to, key) && key !== except)
10
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
- }
12
- return to;
13
- };
14
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
- var dev_exports = {};
16
- module.exports = __toCommonJS(dev_exports);
@@ -1,3 +0,0 @@
1
- import type { SharedExperimentsConfig } from '@rsbuild/shared';
2
- export type ExperimentsConfig = SharedExperimentsConfig;
3
- export type NormalizedExperimentsConfig = Required<ExperimentsConfig>;
@@ -1,16 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __copyProps = (to, from, except, desc) => {
7
- if (from && typeof from === "object" || typeof from === "function") {
8
- for (let key of __getOwnPropNames(from))
9
- if (!__hasOwnProp.call(to, key) && key !== except)
10
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
- }
12
- return to;
13
- };
14
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
- var experiments_exports = {};
16
- module.exports = __toCommonJS(experiments_exports);
@@ -1,3 +0,0 @@
1
- import type { SharedHtmlConfig, NormalizedSharedHtmlConfig } from '@rsbuild/shared';
2
- export type HtmlConfig = SharedHtmlConfig;
3
- export type NormalizedHtmlConfig = NormalizedSharedHtmlConfig;
@@ -1,16 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __copyProps = (to, from, except, desc) => {
7
- if (from && typeof from === "object" || typeof from === "function") {
8
- for (let key of __getOwnPropNames(from))
9
- if (!__hasOwnProp.call(to, key) && key !== except)
10
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
- }
12
- return to;
13
- };
14
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
- var html_exports = {};
16
- module.exports = __toCommonJS(html_exports);
@@ -1,9 +0,0 @@
1
- import type { SharedOutputConfig, NormalizedSharedOutputConfig } from '@rsbuild/shared';
2
- import type { CopyPluginOptions } from '../thirdParty';
3
- export type OutputConfig = SharedOutputConfig & {
4
- /**
5
- * Copies the specified file or directory to the dist directory.
6
- */
7
- copy?: CopyPluginOptions | CopyPluginOptions['patterns'];
8
- };
9
- export type NormalizedOutputConfig = OutputConfig & NormalizedSharedOutputConfig;
@@ -1,16 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __copyProps = (to, from, except, desc) => {
7
- if (from && typeof from === "object" || typeof from === "function") {
8
- for (let key of __getOwnPropNames(from))
9
- if (!__hasOwnProp.call(to, key) && key !== except)
10
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
- }
12
- return to;
13
- };
14
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
- var output_exports = {};
16
- module.exports = __toCommonJS(output_exports);
@@ -1,3 +0,0 @@
1
- import type { SharedPerformanceConfig, NormalizedSharedPerformanceConfig } from '@rsbuild/shared';
2
- export type PerformanceConfig = SharedPerformanceConfig;
3
- export type NormalizedPerformanceConfig = NormalizedSharedPerformanceConfig;
@@ -1,16 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __copyProps = (to, from, except, desc) => {
7
- if (from && typeof from === "object" || typeof from === "function") {
8
- for (let key of __getOwnPropNames(from))
9
- if (!__hasOwnProp.call(to, key) && key !== except)
10
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
- }
12
- return to;
13
- };
14
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
- var performance_exports = {};
16
- module.exports = __toCommonJS(performance_exports);
@@ -1,62 +0,0 @@
1
- /**
2
- * Ref: https://github.com/webpack-contrib/copy-webpack-plugin/blob/master/types/index.d.ts
3
- */
4
- /// <reference types="node" />
5
- export type CopyPluginOptions = {
6
- patterns: Pattern[];
7
- options?: AdditionalOptions | undefined;
8
- };
9
- type ToFunction = (pathData: {
10
- context: string;
11
- absoluteFilename?: string;
12
- }) => string | Promise<string>;
13
- type To = string | ToFunction;
14
- type ToType = 'dir' | 'file' | 'template';
15
- type TransformerFunction = (input: Buffer, absoluteFilename: string) => string | Buffer | Promise<string> | Promise<Buffer>;
16
- type TransformerCacheObject = {
17
- keys: {
18
- [key: string]: any;
19
- };
20
- } | {
21
- keys: (defaultCacheKeys: {
22
- [key: string]: any;
23
- }, absoluteFilename: string) => Promise<{
24
- [key: string]: any;
25
- }>;
26
- };
27
- type TransformerObject = {
28
- transformer: TransformerFunction;
29
- cache?: boolean | TransformerCacheObject | undefined;
30
- };
31
- type Transform = TransformerFunction | TransformerObject;
32
- type Filter = (filepath: string) => boolean | Promise<boolean>;
33
- type TransformAllFunction = (data: {
34
- data: Buffer;
35
- sourceFilename: string;
36
- absoluteFilename: string;
37
- }[]) => string | Buffer | Promise<string> | Promise<Buffer>;
38
- type Info = Record<string, any> | ((item: {
39
- absoluteFilename: string;
40
- sourceFilename: string;
41
- filename: string;
42
- toType: ToType;
43
- }) => Record<string, any>);
44
- type ObjectPattern = {
45
- from: string;
46
- globOptions?: Record<string, any>;
47
- context?: string | undefined;
48
- to?: To | undefined;
49
- toType?: ToType | undefined;
50
- info?: Info | undefined;
51
- filter?: Filter | undefined;
52
- transform?: Transform | undefined;
53
- transformAll?: TransformAllFunction | undefined;
54
- force?: boolean | undefined;
55
- priority?: number | undefined;
56
- noErrorOnMissing?: boolean | undefined;
57
- };
58
- type Pattern = string | ObjectPattern;
59
- type AdditionalOptions = {
60
- concurrency?: number | undefined;
61
- };
62
- export {};
@@ -1,16 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __copyProps = (to, from, except, desc) => {
7
- if (from && typeof from === "object" || typeof from === "function") {
8
- for (let key of __getOwnPropNames(from))
9
- if (!__hasOwnProp.call(to, key) && key !== except)
10
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
- }
12
- return to;
13
- };
14
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
- var CopyWebpackPlugin_exports = {};
16
- module.exports = __toCommonJS(CopyWebpackPlugin_exports);
@@ -1,3 +0,0 @@
1
- import type { PugOptions } from '@rsbuild/shared';
2
- import type { webpack } from '../types';
3
- export default function (this: webpack.LoaderContext<PugOptions>, source: string): string;
@@ -1,44 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var pugLoader_exports = {};
30
- __export(pugLoader_exports, {
31
- default: () => pugLoader_default
32
- });
33
- module.exports = __toCommonJS(pugLoader_exports);
34
- var import_pug = __toESM(require("@rsbuild/shared/pug"));
35
- function pugLoader_default(source) {
36
- const options = {
37
- filename: this.resourcePath,
38
- doctype: "html",
39
- compileDebug: false,
40
- ...this.getOptions()
41
- };
42
- const templateCode = import_pug.default.compileClient(source, options);
43
- return `${templateCode}; module.exports = template;`;
44
- }