@lynx-js/rspeedy 0.8.2

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 (127) hide show
  1. package/CHANGELOG.md +208 -0
  2. package/LICENSE +202 -0
  3. package/README.md +32 -0
  4. package/bin/rspeedy.js +33 -0
  5. package/client/hmr/WebSocketClient.js +65 -0
  6. package/client.d.ts +5 -0
  7. package/lib/api.d.ts +46 -0
  8. package/lib/api.js +2 -0
  9. package/lib/cli/build.d.ts +4 -0
  10. package/lib/cli/build.js +32 -0
  11. package/lib/cli/commands.d.ts +5 -0
  12. package/lib/cli/commands.js +45 -0
  13. package/lib/cli/dev.d.ts +4 -0
  14. package/lib/cli/dev.js +75 -0
  15. package/lib/cli/exit.d.ts +1 -0
  16. package/lib/cli/exit.js +51 -0
  17. package/lib/cli/inspect.d.ts +8 -0
  18. package/lib/cli/inspect.js +30 -0
  19. package/lib/cli/main.d.ts +1 -0
  20. package/lib/cli/main.js +39 -0
  21. package/lib/cli/preview.d.ts +4 -0
  22. package/lib/cli/preview.js +31 -0
  23. package/lib/cli/start.d.ts +6 -0
  24. package/lib/cli/start.js +88 -0
  25. package/lib/config/defaults.d.ts +2 -0
  26. package/lib/config/defaults.js +32 -0
  27. package/lib/config/defineConfig.d.ts +22 -0
  28. package/lib/config/defineConfig.js +24 -0
  29. package/lib/config/dev/client.d.ts +15 -0
  30. package/lib/config/dev/client.js +2 -0
  31. package/lib/config/dev/index.d.ts +133 -0
  32. package/lib/config/dev/index.js +2 -0
  33. package/lib/config/index.d.ts +172 -0
  34. package/lib/config/index.js +2 -0
  35. package/lib/config/loadConfig.d.ts +50 -0
  36. package/lib/config/loadConfig.js +98 -0
  37. package/lib/config/output/css-modules.d.ts +84 -0
  38. package/lib/config/output/css-modules.js +2 -0
  39. package/lib/config/output/dist-path.d.ts +68 -0
  40. package/lib/config/output/dist-path.js +2 -0
  41. package/lib/config/output/filename.d.ts +167 -0
  42. package/lib/config/output/filename.js +2 -0
  43. package/lib/config/output/index.d.ts +320 -0
  44. package/lib/config/output/index.js +2 -0
  45. package/lib/config/output/minify.d.ts +80 -0
  46. package/lib/config/output/minify.js +2 -0
  47. package/lib/config/output/source-map.d.ts +68 -0
  48. package/lib/config/output/source-map.js +2 -0
  49. package/lib/config/performance/chunk-split.d.ts +192 -0
  50. package/lib/config/performance/chunk-split.js +2 -0
  51. package/lib/config/performance/index.d.ts +50 -0
  52. package/lib/config/performance/index.js +2 -0
  53. package/lib/config/rsbuild/entry.d.ts +3 -0
  54. package/lib/config/rsbuild/entry.js +31 -0
  55. package/lib/config/rsbuild/index.d.ts +4 -0
  56. package/lib/config/rsbuild/index.js +70 -0
  57. package/lib/config/server/index.d.ts +47 -0
  58. package/lib/config/server/index.js +2 -0
  59. package/lib/config/source/decorators.d.ts +43 -0
  60. package/lib/config/source/decorators.js +2 -0
  61. package/lib/config/source/entry.d.ts +84 -0
  62. package/lib/config/source/entry.js +2 -0
  63. package/lib/config/source/index.d.ts +474 -0
  64. package/lib/config/source/index.js +2 -0
  65. package/lib/config/source/transformImport.d.ts +106 -0
  66. package/lib/config/source/transformImport.js +2 -0
  67. package/lib/config/tools/css-extract.d.ts +72 -0
  68. package/lib/config/tools/css-extract.js +2 -0
  69. package/lib/config/tools/css-loader.d.ts +130 -0
  70. package/lib/config/tools/css-loader.js +2 -0
  71. package/lib/config/tools/index.d.ts +170 -0
  72. package/lib/config/tools/index.js +2 -0
  73. package/lib/config/validate.d.ts +4 -0
  74. package/lib/config/validate.js +28962 -0
  75. package/lib/create-rspeedy.d.ts +45 -0
  76. package/lib/create-rspeedy.js +48 -0
  77. package/lib/debug.d.ts +3 -0
  78. package/lib/debug.js +25 -0
  79. package/lib/index.d.ts +45 -0
  80. package/lib/index.js +10 -0
  81. package/lib/plugins/api.plugin.d.ts +3 -0
  82. package/lib/plugins/api.plugin.js +25 -0
  83. package/lib/plugins/chunkLoading.plugin.d.ts +2 -0
  84. package/lib/plugins/chunkLoading.plugin.js +30 -0
  85. package/lib/plugins/dev.plugin.d.ts +5 -0
  86. package/lib/plugins/dev.plugin.js +130 -0
  87. package/lib/plugins/index.d.ts +3 -0
  88. package/lib/plugins/index.js +49 -0
  89. package/lib/plugins/inspect.plugin.d.ts +4 -0
  90. package/lib/plugins/inspect.plugin.js +39 -0
  91. package/lib/plugins/minify.plugin.d.ts +3 -0
  92. package/lib/plugins/minify.plugin.js +89 -0
  93. package/lib/plugins/optimization.plugin.d.ts +2 -0
  94. package/lib/plugins/optimization.plugin.js +31 -0
  95. package/lib/plugins/output.plugin.d.ts +3 -0
  96. package/lib/plugins/output.plugin.js +34 -0
  97. package/lib/plugins/resolve.plugin.d.ts +2 -0
  98. package/lib/plugins/resolve.plugin.js +38 -0
  99. package/lib/plugins/rsdoctor.plugin.d.ts +3 -0
  100. package/lib/plugins/rsdoctor.plugin.js +41 -0
  101. package/lib/plugins/sourcemap.plugin.d.ts +2 -0
  102. package/lib/plugins/sourcemap.plugin.js +84 -0
  103. package/lib/plugins/stats.plugin.d.ts +2 -0
  104. package/lib/plugins/stats.plugin.js +20 -0
  105. package/lib/plugins/swc.plugin.d.ts +2 -0
  106. package/lib/plugins/swc.plugin.js +21 -0
  107. package/lib/plugins/target.plugin.d.ts +2 -0
  108. package/lib/plugins/target.plugin.js +12 -0
  109. package/lib/utils/getESVersionTarget.d.ts +1 -0
  110. package/lib/utils/getESVersionTarget.js +7 -0
  111. package/lib/utils/is-ci.d.ts +1 -0
  112. package/lib/utils/is-ci.js +7 -0
  113. package/lib/version.d.ts +4 -0
  114. package/lib/version.js +15 -0
  115. package/lib/webpack/CompilationIdPlugin.d.ts +4 -0
  116. package/lib/webpack/CompilationIdPlugin.js +20 -0
  117. package/lib/webpack/EvalSourceMapDevToolPlugin.d.ts +9 -0
  118. package/lib/webpack/EvalSourceMapDevToolPlugin.js +15 -0
  119. package/lib/webpack/ProvidePlugin.d.ts +9 -0
  120. package/lib/webpack/ProvidePlugin.js +15 -0
  121. package/lib/webpack/SourceMapDevToolPlugin.d.ts +9 -0
  122. package/lib/webpack/SourceMapDevToolPlugin.js +15 -0
  123. package/package.json +83 -0
  124. package/register/data.d.ts +9 -0
  125. package/register/hooks.js +146 -0
  126. package/register/index.d.ts +4 -0
  127. package/register/index.js +47 -0
@@ -0,0 +1,130 @@
1
+ import type { CssModuleLocalsConvention } from '../output/css-modules.js';
2
+ /**
3
+ * {@inheritdoc Tools.cssLoader}
4
+ *
5
+ * @public
6
+ */
7
+ export interface CssLoader {
8
+ /**
9
+ * The option `importLoaders` allows you to configure how many loaders before `css-loader` should be applied to `@imported` resources and CSS modules imports.
10
+ *
11
+ * @remarks
12
+ *
13
+ * The default value of `importLoaders` is:
14
+ *
15
+ * - `1` when compiling CSS files
16
+ *
17
+ * - `2` when compiling Sass or Less files
18
+ *
19
+ * See {@link https://github.com/webpack-contrib/css-loader?tab=readme-ov-file#importloaders | css-loader#import-loaders} for details.
20
+ */
21
+ importLoaders?: 0 | 1 | 2 | undefined;
22
+ /**
23
+ * The {@link CssLoaderModules | cssLoader.modules} option enables/disables the CSS Modules specification and setup basic behavior.
24
+ *
25
+ * @example
26
+ *
27
+ * Using `false` value to increase performance because we avoid parsing CSS Modules features, it will be useful for developers who use vanilla css or use other technologies.
28
+ *
29
+ * ```js
30
+ * import { defineConfig } from '@lynx-js/rspeedy'
31
+ *
32
+ * export default defineConfig({
33
+ * tools: {
34
+ * cssLoader: {
35
+ * modules: false,
36
+ * },
37
+ * },
38
+ * })
39
+ * ```
40
+ *
41
+ * @example
42
+ *
43
+ * Using `() => true` value to enable CSS Modules for all files.
44
+ *
45
+ * ```js
46
+ * import { defineConfig } from '@lynx-js/rspeedy'
47
+ *
48
+ * export default defineConfig({
49
+ * tools: {
50
+ * cssLoader: {
51
+ * modules: () => true,
52
+ * },
53
+ * },
54
+ * })
55
+ * ```
56
+ *
57
+ * @example
58
+ *
59
+ * Using object value to enable CSS Modules based-on {@link CssLoaderModules.auto} option and setup more configurations about CSS Modules.
60
+ *
61
+ * ```js
62
+ * import { defineConfig } from '@lynx-js/rspeedy'
63
+ *
64
+ * export default defineConfig({
65
+ * tools: {
66
+ * cssLoader: {
67
+ * modules: {
68
+ * namedExport: true,
69
+ * },
70
+ * },
71
+ * },
72
+ * })
73
+ * ```
74
+ */
75
+ modules?: boolean | CssLoaderModules | undefined;
76
+ }
77
+ /**
78
+ * {@inheritdoc CssLoader.modules}
79
+ *
80
+ * @public
81
+ */
82
+ export interface CssLoaderModules {
83
+ /**
84
+ * {@inheritdoc CssModules.auto}
85
+ */
86
+ auto?: boolean | RegExp | ((filename: string) => boolean) | undefined;
87
+ /**
88
+ * {@inheritdoc CssModules.exportLocalsConvention}
89
+ */
90
+ exportLocalsConvention?: CssModuleLocalsConvention | undefined;
91
+ /**
92
+ * {@inheritdoc CssModules.localIdentName}
93
+ */
94
+ localIdentName?: string | undefined;
95
+ /**
96
+ * Enables/disables ES modules named export for locals.
97
+ *
98
+ * @example
99
+ *
100
+ * - `style.css`
101
+ *
102
+ * ```css
103
+ * .foo-baz {
104
+ * color: red;
105
+ * }
106
+ * .bar {
107
+ * color: blue;
108
+ * }
109
+ * .default {
110
+ * color: green;
111
+ * }
112
+ * ```
113
+ *
114
+ * - `index.js`
115
+ *
116
+ * ```js
117
+ * import * as styles from "./styles.css";
118
+ *
119
+ * // If using `exportLocalsConvention: "as-is"` (default value):
120
+ * console.log(styles["foo-baz"], styles.bar);
121
+ *
122
+ * // If using `exportLocalsConvention: "camel-case-only"`:
123
+ * console.log(styles.fooBaz, styles.bar);
124
+ *
125
+ * // For the `default` class name
126
+ * console.log(styles["_default"]);
127
+ * ```
128
+ */
129
+ namedExport?: boolean | undefined;
130
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=css-loader.js.map
@@ -0,0 +1,170 @@
1
+ import type { ToolsConfig } from '@rsbuild/core';
2
+ import type { RsdoctorRspackPlugin } from '@rsdoctor/rspack-plugin';
3
+ import type { CssExtract } from './css-extract.js';
4
+ import type { CssLoader } from './css-loader.js';
5
+ export type RsdoctorRspackPluginOptions = ConstructorParameters<typeof RsdoctorRspackPlugin<[]>>[0];
6
+ /**
7
+ * {@inheritdoc Config.tools}
8
+ *
9
+ * @public
10
+ */
11
+ export interface Tools {
12
+ /**
13
+ * The {@link Tools.bundlerChain} changes the options of {@link https://www.rspack.dev | Rspack} using {@link https://github.com/rspack-contrib/rspack-chain | rspack-chain}.
14
+ *
15
+ * @example
16
+ *
17
+ * ```js
18
+ * import { defineConfig } from '@lynx-js/rspeedy'
19
+ *
20
+ * export default defineConfig({
21
+ * tools: {
22
+ * bundlerChain(chain) {
23
+ * chain.resolve.fullySpecified(true)
24
+ * },
25
+ * },
26
+ * })
27
+ * ```
28
+ *
29
+ * See {@link https://github.com/rspack-contrib/rspack-chain | rspack-chain} for details.
30
+ */
31
+ bundlerChain?: ToolsConfig['bundlerChain'] | undefined;
32
+ /**
33
+ * The {@link CssLoader} controls the options of {@link https://github.com/webpack-contrib/css-loader | css-loader}.
34
+ *
35
+ * @remarks
36
+ *
37
+ * The default option is as follow:
38
+ *
39
+ * ```js
40
+ * const defaultOptions = {
41
+ * modules: {
42
+ * auto: true,
43
+ * namedExport: false,
44
+ * exportLocalsConvention: 'camelCase',
45
+ * localIdentName: output.cssModules.localIdentName,
46
+ * },
47
+ * sourceMap: output.sourceMap,
48
+ * // importLoaders is `1` when compiling css files, and is `2` when compiling sass/less files
49
+ * importLoaders: 1 || 2,
50
+ * };
51
+ * ```
52
+ */
53
+ cssLoader?: CssLoader | undefined;
54
+ /**
55
+ * The {@link CssExtract} controls the options of {@link https://www.rspack.dev/plugins/rspack/css-extract-rspack-plugin | CssExtractRspackPlugin}
56
+ */
57
+ cssExtract?: CssExtract | undefined;
58
+ /**
59
+ * The {@link Tools.rsdoctor} controls the options of {@link https://rsdoctor.dev/ | Rsdoctor}.
60
+ *
61
+ * @example
62
+ *
63
+ * - Use the built-in Rsdoctor.
64
+ *
65
+ * ```js
66
+ * import { defineConfig } from '@lynx-js/rspeedy'
67
+ *
68
+ * export default defineConfig({
69
+ * tools: {
70
+ * rsdoctor: {
71
+ * disableClientServer: true,
72
+ * },
73
+ * },
74
+ * })
75
+ * ```
76
+ *
77
+ * See {@link https://rsdoctor.dev/config/options/options | Rsdoctor - Configuration} for details.
78
+ */
79
+ rsdoctor?: RsdoctorRspackPluginOptions | undefined;
80
+ /**
81
+ * The {@link Tools.rspack} controls the options of {@link https://www.rspack.dev/ | Rspack}.
82
+ *
83
+ * @example
84
+ *
85
+ * - Use object config
86
+ *
87
+ * ```js
88
+ * import { defineConfig } from '@lynx-js/rspeedy'
89
+ *
90
+ * export default defineConfig({
91
+ * tools: {
92
+ * rspack: {
93
+ * resolve: {
94
+ * fullySpecified: true,
95
+ * },
96
+ * },
97
+ * },
98
+ * })
99
+ * ```
100
+ *
101
+ * See {@link https://www.rspack.dev/config/index | Rspack - Configuration} for details.
102
+ *
103
+ * @example
104
+ *
105
+ * - Use function with `env` utils
106
+ *
107
+ * ```js
108
+ * import { defineConfig } from '@lynx-js/rspeedy'
109
+ *
110
+ * export default defineConfig({
111
+ * tools: {
112
+ * rspack(config, { env }) {
113
+ * if (env === 'development') {
114
+ * config.devtool = 'cheap-source-map'
115
+ * }
116
+ * return config
117
+ * },
118
+ * },
119
+ * })
120
+ * ```
121
+ *
122
+ * See {@link https://rsbuild.dev/config/tools/rspack#env | Rsbuild - tools.rspack} for details.
123
+ *
124
+ * @example
125
+ *
126
+ * - Use function with `mergeConfig` utils
127
+ *
128
+ * ```js
129
+ * import { defineConfig } from '@lynx-js/rspeedy'
130
+ *
131
+ * export default defineConfig({
132
+ * tools: {
133
+ * rspack(config, { mergeConfig }) {
134
+ * return mergeConfig(config, {
135
+ * resolve: {
136
+ * fullySpecified: true,
137
+ * },
138
+ * })
139
+ * },
140
+ * },
141
+ * })
142
+ * ```
143
+ *
144
+ * See {@link https://rsbuild.dev/config/tools/rspack#mergeconfig | Rsbuild - tools.rspack} for details.
145
+ *
146
+ * @example
147
+ *
148
+ * - Use function with `appendPlugins` utils
149
+ *
150
+ * ```js
151
+ * import { defineConfig } from '@lynx-js/rspeedy'
152
+ *
153
+ * export default defineConfig({
154
+ * tools: {
155
+ * rspack(config, { appendPlugins, rspack }) {
156
+ * appendPlugins(new rspack.BannerPlugin({ banner: 'Hello, World!' }))
157
+ * return config
158
+ * },
159
+ * },
160
+ * })
161
+ * ```
162
+ *
163
+ * See {@link https://rsbuild.dev/config/tools/rspack#appendplugins | Rsbuild - tools.rspack} for details.
164
+ */
165
+ rspack?: ToolsConfig['rspack'] | undefined;
166
+ /**
167
+ * The {@link Tools.swc} controls the options of {@link https://rspack.dev/guide/features/builtin-swc-loader | builtin:swc-loader}.
168
+ */
169
+ swc?: ToolsConfig['swc'] | undefined;
170
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,4 @@
1
+ import * as typia from 'typia';
2
+ import type { Config } from './index.js';
3
+ export declare const validateConfig: (input: unknown) => typia.IValidation<Config>;
4
+ export declare function validate(input: unknown, configPath?: string): Config;