@rsbuild/core 2.1.4 → 2.1.6
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.
- package/compiled/@rstackjs/load-config/index.d.ts +66 -0
- package/compiled/@rstackjs/load-config/license +21 -0
- package/compiled/@rstackjs/load-config/package.json +1 -0
- package/compiled/css-loader/index.js +2 -2
- package/compiled/html-rspack-plugin/index.d.ts +4 -4
- package/compiled/html-rspack-plugin/index.js +53 -48
- package/compiled/http-proxy-middleware/index.d.ts +2 -1
- package/compiled/http-proxy-middleware/package.json +1 -1
- package/compiled/jiti/dist/babel.cjs +49 -2
- package/compiled/postcss/index.js +1 -1
- package/compiled/postcss/package.json +1 -1
- package/compiled/postcss-loader/index.js +6 -6
- package/compiled/rslog/index.d.ts +7 -14
- package/compiled/rslog/package.json +1 -1
- package/dist/{756.js → 711.js} +162 -237
- package/dist/chokidar.js +33 -33
- package/dist/client/hmr.js +1 -1
- package/dist/client/overlay.js +1 -1
- package/dist/connect-next.js +3 -3
- package/dist/cssUrlLoader.mjs +1 -1
- package/dist/http-proxy-middleware.js +29 -10
- package/dist/ignoreCssLoader.mjs +1 -1
- package/dist/index.js +1 -1
- package/dist/launch-editor-middleware.js +1 -1
- package/dist/manifest-plugin.js +38 -34
- package/dist/memfs.js +370 -202
- package/dist/sirv.js +7 -7
- package/dist/ws.js +1 -1
- package/dist-types/configChain.d.ts +1 -0
- package/dist-types/constants.d.ts +2 -0
- package/dist-types/loadConfig.d.ts +4 -39
- package/dist-types/types/config.d.ts +7 -5
- package/package.json +9 -8
- package/types.d.ts +24 -0
- /package/dist/{349.js → 252.js} +0 -0
- /package/dist/{756.js.LICENSE.txt → 711.js.LICENSE.txt} +0 -0
- /package/dist/client/{60.js → 307.js} +0 -0
- /package/dist/{fresh-import.js → freshImport.js} +0 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
type ConfigLoader = 'auto' | 'jiti' | 'native';
|
|
2
|
+
type ConfigFunction<Config, Params extends unknown[]> = (...params: Params) => Config | Promise<Config>;
|
|
3
|
+
type ConfigDefinition<Config, Params extends unknown[]> = Config | ConfigFunction<Config, Params>;
|
|
4
|
+
type LoadConfigOptions<Params extends unknown[] = []> = {
|
|
5
|
+
/**
|
|
6
|
+
* The root path to resolve the config file.
|
|
7
|
+
* @default process.cwd()
|
|
8
|
+
*/
|
|
9
|
+
cwd?: string;
|
|
10
|
+
/**
|
|
11
|
+
* The path to the config file, can be a relative or absolute path.
|
|
12
|
+
* If `path` is not provided, the function will search for the config file in the `cwd`.
|
|
13
|
+
*/
|
|
14
|
+
path?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Config file names to search in `cwd` when `path` is not provided.
|
|
17
|
+
* Required when `path` is not provided.
|
|
18
|
+
* @default []
|
|
19
|
+
*/
|
|
20
|
+
configFileNames?: string[];
|
|
21
|
+
/**
|
|
22
|
+
* Specify the config loader, can be `auto`, `jiti` or `native`.
|
|
23
|
+
* - 'auto': Use native Node.js loader first, fallback to jiti if failed
|
|
24
|
+
* - 'jiti': Use `jiti` as loader, which supports TypeScript and ESM out of the box
|
|
25
|
+
* - 'native': Use native Node.js loader, requires TypeScript support in Node.js >= 22.6
|
|
26
|
+
* @default 'auto'
|
|
27
|
+
*/
|
|
28
|
+
loader?: ConfigLoader;
|
|
29
|
+
/**
|
|
30
|
+
* The export name to read from the config file.
|
|
31
|
+
* Set to `false` to execute the config file without reading exports.
|
|
32
|
+
* @default 'default'
|
|
33
|
+
*/
|
|
34
|
+
exportName?: string | false;
|
|
35
|
+
/**
|
|
36
|
+
* Arguments passed to a function config export.
|
|
37
|
+
* @default []
|
|
38
|
+
*/
|
|
39
|
+
configParams?: Params;
|
|
40
|
+
/**
|
|
41
|
+
* Whether to bypass module cache when loading the config.
|
|
42
|
+
* @default false
|
|
43
|
+
*/
|
|
44
|
+
fresh?: boolean;
|
|
45
|
+
};
|
|
46
|
+
type LoadConfigResult<Config = unknown> = {
|
|
47
|
+
/**
|
|
48
|
+
* The loaded configuration object.
|
|
49
|
+
*/
|
|
50
|
+
content: Config;
|
|
51
|
+
/**
|
|
52
|
+
* The path to the loaded configuration file.
|
|
53
|
+
* Return `null` if the configuration file is not found.
|
|
54
|
+
*/
|
|
55
|
+
filePath: string | null;
|
|
56
|
+
/**
|
|
57
|
+
* Absolute file paths of statically imported (relative) dependencies of the
|
|
58
|
+
* config file.
|
|
59
|
+
*/
|
|
60
|
+
dependencies: string[];
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
declare function loadConfig<Config = unknown, Params extends unknown[] = []>({ cwd, path, configFileNames, loader, exportName, configParams, fresh, }?: LoadConfigOptions<Params>): Promise<LoadConfigResult<Config>>;
|
|
64
|
+
|
|
65
|
+
export { loadConfig };
|
|
66
|
+
export type { ConfigDefinition, ConfigLoader, LoadConfigOptions, LoadConfigResult };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Rspack Contrib
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"name":"@rstackjs/load-config","version":"0.1.2","license":"MIT","types":"index.d.ts","type":"module"}
|