@lynx-js/rspeedy 0.9.4 → 0.9.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/CHANGELOG.md +71 -0
- package/dist/cli/main.js +6 -6
- package/dist/index.d.ts +211 -10
- package/dist/index.js +8 -4
- package/dist/src_cli_build_ts.js +18 -5
- package/dist/src_cli_commands_ts.js +1 -1
- package/dist/src_cli_dev_ts.js +18 -5
- package/dist/src_cli_inspect_ts.js +18 -5
- package/dist/src_cli_preview_ts.js +18 -5
- package/dist/src_config_validate_ts.js +1785 -1462
- package/dist/src_version_ts.js +1 -1
- package/package.json +13 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,76 @@
|
|
|
1
1
|
# @lynx-js/rspeedy
|
|
2
2
|
|
|
3
|
+
## 0.9.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Support `output.inlineScripts`, which controls whether to inline scripts into Lynx bundle (`.lynx.bundle`). ([#874](https://github.com/lynx-family/lynx-stack/pull/874))
|
|
8
|
+
|
|
9
|
+
Only background thread scripts can remain non-inlined, whereas the main thread script is always inlined.
|
|
10
|
+
|
|
11
|
+
example:
|
|
12
|
+
|
|
13
|
+
```js
|
|
14
|
+
import { defineConfig } from '@lynx-js/rspeedy'
|
|
15
|
+
|
|
16
|
+
export default defineConfig({
|
|
17
|
+
output: {
|
|
18
|
+
inlineScripts: false,
|
|
19
|
+
},
|
|
20
|
+
})
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
- Bump Rsbuild v1.3.21 with Rspack v1.3.11. ([#863](https://github.com/lynx-family/lynx-stack/pull/863))
|
|
24
|
+
|
|
25
|
+
- Updated dependencies [[`5b67bde`](https://github.com/lynx-family/lynx-stack/commit/5b67bde8a7286b9dcc727c9707cf83020bb5abfa)]:
|
|
26
|
+
- @lynx-js/chunk-loading-webpack-plugin@0.2.1
|
|
27
|
+
|
|
28
|
+
## 0.9.5
|
|
29
|
+
|
|
30
|
+
### Patch Changes
|
|
31
|
+
|
|
32
|
+
- Support `source.preEntry`. ([#750](https://github.com/lynx-family/lynx-stack/pull/750))
|
|
33
|
+
|
|
34
|
+
Add a script before the entry file of each page. This script will be executed before the page code.
|
|
35
|
+
It can be used to execute global logics, such as injecting polyfills, setting global styles, etc.
|
|
36
|
+
|
|
37
|
+
example:
|
|
38
|
+
|
|
39
|
+
```js
|
|
40
|
+
import { defineConfig } from '@lynx-js/rspeedy'
|
|
41
|
+
export default defineConfig({
|
|
42
|
+
source: {
|
|
43
|
+
preEntry: './src/polyfill.ts',
|
|
44
|
+
},
|
|
45
|
+
})
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
- Bump Rsbuild v1.3.20 with Rspack v1.3.10. ([#799](https://github.com/lynx-family/lynx-stack/pull/799))
|
|
49
|
+
|
|
50
|
+
- Add `callerName` option to `createRspeedy`. ([#757](https://github.com/lynx-family/lynx-stack/pull/757))
|
|
51
|
+
|
|
52
|
+
It can be accessed by Rsbuild plugins through [`api.context.callerName`](https://rsbuild.dev/api/javascript-api/instance#contextcallername), and execute different logic based on this identifier.
|
|
53
|
+
|
|
54
|
+
```js
|
|
55
|
+
export const myPlugin = {
|
|
56
|
+
name: 'my-plugin',
|
|
57
|
+
setup(api) {
|
|
58
|
+
const { callerName } = api.context
|
|
59
|
+
|
|
60
|
+
if (callerName === 'rslib') {
|
|
61
|
+
// ...
|
|
62
|
+
} else if (callerName === 'rspeedy') {
|
|
63
|
+
// ...
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
- Support `performance.buildCache`. ([#766](https://github.com/lynx-family/lynx-stack/pull/766))
|
|
70
|
+
|
|
71
|
+
- Updated dependencies [[`fbc4fbb`](https://github.com/lynx-family/lynx-stack/commit/fbc4fbbdb572ad7128a33dc06e8d8a026d18e388)]:
|
|
72
|
+
- @lynx-js/webpack-dev-transport@0.1.3
|
|
73
|
+
|
|
3
74
|
## 0.9.4
|
|
4
75
|
|
|
5
76
|
### Patch Changes
|
package/dist/cli/main.js
CHANGED
|
@@ -194,9 +194,9 @@ var __webpack_modules__ = {
|
|
|
194
194
|
NW: ()=>debugList,
|
|
195
195
|
fF: ()=>debug
|
|
196
196
|
});
|
|
197
|
-
var
|
|
198
|
-
var
|
|
199
|
-
var
|
|
197
|
+
var _rsbuild_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("@rsbuild/core");
|
|
198
|
+
var picocolors__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|
|
199
|
+
var picocolors__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/ __webpack_require__.n(picocolors__WEBPACK_IMPORTED_MODULE_0__);
|
|
200
200
|
const isDebug = ()=>{
|
|
201
201
|
if (!process.env['DEBUG']) return false;
|
|
202
202
|
const values = process.env['DEBUG'].toLocaleLowerCase().split(',');
|
|
@@ -206,12 +206,12 @@ var __webpack_modules__ = {
|
|
|
206
206
|
'*'
|
|
207
207
|
].some((key)=>values.includes(key));
|
|
208
208
|
};
|
|
209
|
-
const label =
|
|
209
|
+
const label = picocolors__WEBPACK_IMPORTED_MODULE_0___default().bgCyan('lynx');
|
|
210
210
|
const debug = (message)=>{
|
|
211
211
|
if (isDebug()) {
|
|
212
212
|
const result = 'string' == typeof message ? message : message();
|
|
213
|
-
|
|
214
|
-
|
|
213
|
+
_rsbuild_core__WEBPACK_IMPORTED_MODULE_1__.logger.level = 'verbose';
|
|
214
|
+
_rsbuild_core__WEBPACK_IMPORTED_MODULE_1__.logger.debug(`${label} ${result}`);
|
|
215
215
|
}
|
|
216
216
|
};
|
|
217
217
|
const debugList = (prefix, messages)=>debug(()=>`${prefix} ${[
|
package/dist/index.d.ts
CHANGED
|
@@ -31,6 +31,79 @@ import { rspack } from '@rsbuild/core';
|
|
|
31
31
|
import type { ToolsConfig } from '@rsbuild/core';
|
|
32
32
|
import type { WatchFiles } from '@rsbuild/core';
|
|
33
33
|
|
|
34
|
+
/**
|
|
35
|
+
* {@inheritdoc Performance.buildCache}
|
|
36
|
+
*
|
|
37
|
+
* @beta
|
|
38
|
+
*/
|
|
39
|
+
export declare interface BuildCache {
|
|
40
|
+
/**
|
|
41
|
+
* Add additional cache digests, the previous build cache will be invalidated
|
|
42
|
+
* when any value in the array changes.
|
|
43
|
+
*
|
|
44
|
+
* @defaultValue undefined
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
*
|
|
48
|
+
* Add `process.env.SOME_ENV` to the cache digest.
|
|
49
|
+
*
|
|
50
|
+
* ```js
|
|
51
|
+
* import { defineConfig } from '@lynx-js/rspeedy'
|
|
52
|
+
*
|
|
53
|
+
* export default defineConfig({
|
|
54
|
+
* performance: {
|
|
55
|
+
* buildCache: {
|
|
56
|
+
* cacheDigest: [process.env.SOME_ENV],
|
|
57
|
+
* },
|
|
58
|
+
* },
|
|
59
|
+
* })
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
cacheDigest?: Array<string | undefined> | undefined;
|
|
63
|
+
/**
|
|
64
|
+
* The output directory of the cache files.
|
|
65
|
+
*
|
|
66
|
+
* @defaultValue 'node_modules/.cache'
|
|
67
|
+
*/
|
|
68
|
+
cacheDirectory?: string | undefined;
|
|
69
|
+
/**
|
|
70
|
+
* An array of files containing build dependencies.
|
|
71
|
+
* Rspack will use the hash of each of these files to invalidate the persistent cache.
|
|
72
|
+
*
|
|
73
|
+
* @remarks
|
|
74
|
+
*
|
|
75
|
+
* Rspeedy will use the following configuration files as the default build dependencies:
|
|
76
|
+
*
|
|
77
|
+
* - `package.json`
|
|
78
|
+
*
|
|
79
|
+
* - `tsconfig.json` (or `source.tsconfigPath`)
|
|
80
|
+
*
|
|
81
|
+
* - `.env`, `.env.*`
|
|
82
|
+
*
|
|
83
|
+
* - `tailwindcss.config.*`
|
|
84
|
+
*
|
|
85
|
+
* When using Rspeedy CLI, it will also automatically add
|
|
86
|
+
* `lynx.config.js` to the build dependencies.
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
*
|
|
90
|
+
* Add `postcss.config.js` to the build dependencies.
|
|
91
|
+
*
|
|
92
|
+
* ```js
|
|
93
|
+
* import { defineConfig } from '@lynx-js/rspeedy'
|
|
94
|
+
*
|
|
95
|
+
* export default defineConfig({
|
|
96
|
+
* performance: {
|
|
97
|
+
* buildCache: {
|
|
98
|
+
* buildDependencies: ['postcss.config.js'],
|
|
99
|
+
* },
|
|
100
|
+
* },
|
|
101
|
+
* })
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
buildDependencies?: string[] | undefined;
|
|
105
|
+
}
|
|
106
|
+
|
|
34
107
|
/**
|
|
35
108
|
* {@inheritdoc Performance.chunkSplit}
|
|
36
109
|
*
|
|
@@ -417,7 +490,7 @@ export declare type ConsoleType = 'log' | 'warn' | 'error' | 'info' | 'debug' |
|
|
|
417
490
|
*
|
|
418
491
|
* @public
|
|
419
492
|
*/
|
|
420
|
-
export declare function createRspeedy({ cwd, rspeedyConfig, loadEnv, environment }: CreateRspeedyOptions): Promise<RspeedyInstance>;
|
|
493
|
+
export declare function createRspeedy({ cwd, rspeedyConfig, loadEnv, environment, callerName, }: CreateRspeedyOptions): Promise<RspeedyInstance>;
|
|
421
494
|
|
|
422
495
|
/**
|
|
423
496
|
* The options of `createRspeedy` method.
|
|
@@ -448,6 +521,42 @@ export declare interface CreateRspeedyOptions {
|
|
|
448
521
|
* @defaultValue []
|
|
449
522
|
*/
|
|
450
523
|
environment?: CreateRsbuildOptions['environment'];
|
|
524
|
+
/**
|
|
525
|
+
* The name of the framework or tool that is currently invoking Rsbuild.
|
|
526
|
+
* This allows plugins to tailor their behavior based on the calling context.
|
|
527
|
+
*
|
|
528
|
+
* @example
|
|
529
|
+
*
|
|
530
|
+
* Rsbuild plugins can access this value via `api.context.callerName`.
|
|
531
|
+
*
|
|
532
|
+
* ```js
|
|
533
|
+
* export function myPlugin() {
|
|
534
|
+
* return {
|
|
535
|
+
* name: 'my-plugin',
|
|
536
|
+
* setup(api) {
|
|
537
|
+
* // Log the name of the tool invoking Rsbuild
|
|
538
|
+
* console.log(`Called by: ${api.context.callerName}`);
|
|
539
|
+
*
|
|
540
|
+
* // Conditionally apply plugin logic based on caller
|
|
541
|
+
* if (api.context.callerName === 'rspeedy') {
|
|
542
|
+
* api.modifyRsbuildConfig((config) => {
|
|
543
|
+
* // Apply rspeedy-specific config changes
|
|
544
|
+
* return config;
|
|
545
|
+
* });
|
|
546
|
+
* } else if (api.context.callerName === 'rslib') {
|
|
547
|
+
* api.modifyRsbuildConfig((config) => {
|
|
548
|
+
* // Apply rslib-specific config changes
|
|
549
|
+
* return config;
|
|
550
|
+
* });
|
|
551
|
+
* }
|
|
552
|
+
* }
|
|
553
|
+
* };
|
|
554
|
+
* }
|
|
555
|
+
* ```
|
|
556
|
+
*
|
|
557
|
+
* @defaultValue 'rspeedy'
|
|
558
|
+
*/
|
|
559
|
+
callerName?: string;
|
|
451
560
|
}
|
|
452
561
|
|
|
453
562
|
/**
|
|
@@ -1849,6 +1958,31 @@ export declare interface Output {
|
|
|
1849
1958
|
* - `contenthash`: The hash value of the file content. The hash value will only change when the content of the file itself changes.
|
|
1850
1959
|
*/
|
|
1851
1960
|
filenameHash?: boolean | string | undefined;
|
|
1961
|
+
/**
|
|
1962
|
+
* The {@link Output.inlineScripts} option controls whether to inline scripts into Lynx bundle (`.lynx.bundle`).
|
|
1963
|
+
*
|
|
1964
|
+
* @remarks
|
|
1965
|
+
*
|
|
1966
|
+
* If no value is provided, the default value would be `true`.
|
|
1967
|
+
*
|
|
1968
|
+
* This is different with {@link https://rsbuild.dev/config/output/inline-scripts | output.inlineScripts } since we normally want to inline scripts in Lynx bundle (`.lynx.bundle`).
|
|
1969
|
+
*
|
|
1970
|
+
* Only background thread scripts can remain non-inlined, whereas the main thread script is always inlined.
|
|
1971
|
+
*
|
|
1972
|
+
* @example
|
|
1973
|
+
*
|
|
1974
|
+
* Disable inlining background thread scripts.
|
|
1975
|
+
* ```js
|
|
1976
|
+
* import { defineConfig } from '@lynx-js/rspeedy'
|
|
1977
|
+
*
|
|
1978
|
+
* export default defineConfig({
|
|
1979
|
+
* output: {
|
|
1980
|
+
* inlineScripts: false,
|
|
1981
|
+
* },
|
|
1982
|
+
* })
|
|
1983
|
+
* ```
|
|
1984
|
+
*/
|
|
1985
|
+
inlineScripts?: boolean | undefined;
|
|
1852
1986
|
/**
|
|
1853
1987
|
* The {@link Output.legalComments} controls how to handle the legal comment.
|
|
1854
1988
|
*
|
|
@@ -1895,6 +2029,43 @@ export declare interface Output {
|
|
|
1895
2029
|
* @public
|
|
1896
2030
|
*/
|
|
1897
2031
|
export declare interface Performance {
|
|
2032
|
+
/**
|
|
2033
|
+
* Enable or configure persistent build cache.
|
|
2034
|
+
*
|
|
2035
|
+
* @beta This feature is experimental and may be changed in the future.
|
|
2036
|
+
*
|
|
2037
|
+
* @example
|
|
2038
|
+
*
|
|
2039
|
+
* Enable persistent build cache.
|
|
2040
|
+
*
|
|
2041
|
+
* ```js
|
|
2042
|
+
* import { defineConfig } from '@lynx-js/rspeedy'
|
|
2043
|
+
*
|
|
2044
|
+
* export default defineConfig({
|
|
2045
|
+
* performance: {
|
|
2046
|
+
* buildCache: true,
|
|
2047
|
+
* },
|
|
2048
|
+
* })
|
|
2049
|
+
* ```
|
|
2050
|
+
*
|
|
2051
|
+
* @example
|
|
2052
|
+
*
|
|
2053
|
+
* Customize build cache.
|
|
2054
|
+
*
|
|
2055
|
+
* ```js
|
|
2056
|
+
* import { defineConfig } from '@lynx-js/rspeedy'
|
|
2057
|
+
*
|
|
2058
|
+
* export default defineConfig({
|
|
2059
|
+
* performance: {
|
|
2060
|
+
* buildCache: {
|
|
2061
|
+
* cacheDigest: [process.env.SOME_ENV],
|
|
2062
|
+
* buildDependencies: ['postcss.config.js'],
|
|
2063
|
+
* },
|
|
2064
|
+
* },
|
|
2065
|
+
* })
|
|
2066
|
+
* ```
|
|
2067
|
+
*/
|
|
2068
|
+
buildCache?: BuildCache | boolean | undefined;
|
|
1898
2069
|
/**
|
|
1899
2070
|
* {@link Performance.chunkSplit} is used to configure the chunk splitting strategy.
|
|
1900
2071
|
*/
|
|
@@ -2415,7 +2586,9 @@ export declare interface Source {
|
|
|
2415
2586
|
* ```js
|
|
2416
2587
|
* import { defineConfig } from '@lynx-js/rspeedy'
|
|
2417
2588
|
* export default defineConfig({
|
|
2418
|
-
*
|
|
2589
|
+
* source: {
|
|
2590
|
+
* entry: './src/pages/main/index.js',
|
|
2591
|
+
* },
|
|
2419
2592
|
* })
|
|
2420
2593
|
* ```
|
|
2421
2594
|
*
|
|
@@ -2426,7 +2599,9 @@ export declare interface Source {
|
|
|
2426
2599
|
* ```js
|
|
2427
2600
|
* import { defineConfig } from '@lynx-js/rspeedy'
|
|
2428
2601
|
* export default defineConfig({
|
|
2429
|
-
*
|
|
2602
|
+
* source: {
|
|
2603
|
+
* entry: ['./src/prefetch.js', './src/pages/main/index.js'],
|
|
2604
|
+
* },
|
|
2430
2605
|
* })
|
|
2431
2606
|
* ```
|
|
2432
2607
|
*
|
|
@@ -2437,9 +2612,11 @@ export declare interface Source {
|
|
|
2437
2612
|
* ```js
|
|
2438
2613
|
* import { defineConfig } from '@lynx-js/rspeedy'
|
|
2439
2614
|
* export default defineConfig({
|
|
2440
|
-
*
|
|
2441
|
-
*
|
|
2442
|
-
*
|
|
2615
|
+
* source: {
|
|
2616
|
+
* entry: {
|
|
2617
|
+
* foo: './src/pages/foo/index.js',
|
|
2618
|
+
* bar: ['./src/pages/bar/index.js', './src/post.js'], // multiple entry modules is allowed
|
|
2619
|
+
* },
|
|
2443
2620
|
* },
|
|
2444
2621
|
* })
|
|
2445
2622
|
* ```
|
|
@@ -2451,10 +2628,12 @@ export declare interface Source {
|
|
|
2451
2628
|
* ```js
|
|
2452
2629
|
* import { defineConfig } from '@lynx-js/rspeedy'
|
|
2453
2630
|
* export default defineConfig({
|
|
2454
|
-
*
|
|
2455
|
-
*
|
|
2456
|
-
*
|
|
2457
|
-
*
|
|
2631
|
+
* source: {
|
|
2632
|
+
* entry: {
|
|
2633
|
+
* foo: './src/pages/foo/index.js',
|
|
2634
|
+
* bar: {
|
|
2635
|
+
* import: ['./src/prefetch.js', './src/pages/bar'],
|
|
2636
|
+
* },
|
|
2458
2637
|
* },
|
|
2459
2638
|
* },
|
|
2460
2639
|
* })
|
|
@@ -2597,6 +2776,28 @@ export declare interface Source {
|
|
|
2597
2776
|
* ```
|
|
2598
2777
|
*/
|
|
2599
2778
|
include?: Rspack.RuleSetCondition[] | undefined;
|
|
2779
|
+
/**
|
|
2780
|
+
* Add a script before the entry file of each page. This script will be executed before the page code.
|
|
2781
|
+
* It can be used to execute global logics, such as injecting polyfills, setting global styles, etc.
|
|
2782
|
+
*
|
|
2783
|
+
* @remarks
|
|
2784
|
+
*
|
|
2785
|
+
* See {@link https://rsbuild.dev/config/source/pre-entry | source.preEntry} for more details.
|
|
2786
|
+
*
|
|
2787
|
+
* @example
|
|
2788
|
+
*
|
|
2789
|
+
* Relative path will be resolved relative to the project root directory.
|
|
2790
|
+
*
|
|
2791
|
+
* ```js
|
|
2792
|
+
* import { defineConfig } from '@lynx-js/rspeedy'
|
|
2793
|
+
* export default defineConfig({
|
|
2794
|
+
* source: {
|
|
2795
|
+
* preEntry: './src/polyfill.ts',
|
|
2796
|
+
* },
|
|
2797
|
+
* })
|
|
2798
|
+
* ```
|
|
2799
|
+
*/
|
|
2800
|
+
preEntry?: string | string[] | undefined;
|
|
2600
2801
|
/**
|
|
2601
2802
|
* The {@link TransformImport} option transforms the import paths to enable modular imports from subpaths of third-party packages, similar to the functionality provided by {@link https://npmjs.com/package/babel-plugin-import | babel-plugin-import}.
|
|
2602
2803
|
*
|
package/dist/index.js
CHANGED
|
@@ -112,7 +112,7 @@ var __webpack_modules__ = {
|
|
|
112
112
|
});
|
|
113
113
|
var core_ = __webpack_require__("@rsbuild/core");
|
|
114
114
|
var package_namespaceObject = {
|
|
115
|
-
i8: "0.9.
|
|
115
|
+
i8: "0.9.6"
|
|
116
116
|
};
|
|
117
117
|
const version = package_namespaceObject.i8;
|
|
118
118
|
const rspackVersion = core_.rspack.rspackVersion;
|
|
@@ -256,7 +256,8 @@ var core_ = __webpack_require__("@rsbuild/core");
|
|
|
256
256
|
function applyDefaultRspeedyConfig(config) {
|
|
257
257
|
const ret = (0, core_.mergeRsbuildConfig)({
|
|
258
258
|
output: {
|
|
259
|
-
filename: getFilename(config.output?.filename)
|
|
259
|
+
filename: getFilename(config.output?.filename),
|
|
260
|
+
inlineScripts: true
|
|
260
261
|
},
|
|
261
262
|
tools: {
|
|
262
263
|
rsdoctor: {
|
|
@@ -355,6 +356,7 @@ function toRsbuildConfig(config) {
|
|
|
355
356
|
entry: toRsbuildEntry(config.source?.entry),
|
|
356
357
|
exclude: config.source?.exclude,
|
|
357
358
|
include: config.source?.include,
|
|
359
|
+
preEntry: config.source?.preEntry,
|
|
358
360
|
transformImport: config.source?.transformImport,
|
|
359
361
|
tsconfigPath: config.source?.tsconfigPath
|
|
360
362
|
},
|
|
@@ -367,6 +369,7 @@ function toRsbuildConfig(config) {
|
|
|
367
369
|
},
|
|
368
370
|
plugins: config.plugins,
|
|
369
371
|
performance: {
|
|
372
|
+
buildCache: config.performance?.buildCache,
|
|
370
373
|
chunkSplit: config.performance?.chunkSplit,
|
|
371
374
|
profile: config.performance?.profile,
|
|
372
375
|
removeConsole: toRsbuildRemoveConsole(config),
|
|
@@ -394,14 +397,15 @@ function toRsbuildRemoveConsole(config) {
|
|
|
394
397
|
];
|
|
395
398
|
return config.performance?.removeConsole;
|
|
396
399
|
}
|
|
397
|
-
async function createRspeedy({ cwd = process.cwd(), rspeedyConfig = {}, loadEnv = true, environment = [] }) {
|
|
400
|
+
async function createRspeedy({ cwd = process.cwd(), rspeedyConfig = {}, loadEnv = true, environment = [], callerName = 'rspeedy' }) {
|
|
398
401
|
const config = applyDefaultRspeedyConfig(rspeedyConfig);
|
|
399
402
|
const [rspeedy, { applyDefaultPlugins }] = await Promise.all([
|
|
400
403
|
(0, core_.createRsbuild)({
|
|
401
404
|
cwd,
|
|
402
405
|
loadEnv,
|
|
403
406
|
rsbuildConfig: toRsbuildConfig(config),
|
|
404
|
-
environment
|
|
407
|
+
environment,
|
|
408
|
+
callerName
|
|
405
409
|
}),
|
|
406
410
|
__webpack_require__.e("src_plugins_index_ts").then(__webpack_require__.bind(__webpack_require__, "./src/plugins/index.ts"))
|
|
407
411
|
]);
|
package/dist/src_cli_build_ts.js
CHANGED
|
@@ -15,7 +15,7 @@ export const __webpack_modules__ = {
|
|
|
15
15
|
async function build(cwd, buildOptions) {
|
|
16
16
|
const shouldExit = 'true' !== process.env['RSDOCTOR'] || (0, _utils_is_ci_js__WEBPACK_IMPORTED_MODULE_4__.y)();
|
|
17
17
|
try {
|
|
18
|
-
const { createRspeedyOptions } = await (0, _init_js__WEBPACK_IMPORTED_MODULE_3__.
|
|
18
|
+
const { createRspeedyOptions } = await (0, _init_js__WEBPACK_IMPORTED_MODULE_3__.init)(cwd, buildOptions);
|
|
19
19
|
const rspeedy = await (0, _create_rspeedy_js__WEBPACK_IMPORTED_MODULE_2__.S)(createRspeedyOptions);
|
|
20
20
|
await rspeedy.build();
|
|
21
21
|
} catch (error) {
|
|
@@ -27,7 +27,7 @@ export const __webpack_modules__ = {
|
|
|
27
27
|
},
|
|
28
28
|
"./src/cli/init.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
29
29
|
__webpack_require__.d(__webpack_exports__, {
|
|
30
|
-
|
|
30
|
+
init: ()=>init
|
|
31
31
|
});
|
|
32
32
|
var external_node_fs_ = __webpack_require__("node:fs");
|
|
33
33
|
var external_node_path_ = __webpack_require__("node:path");
|
|
@@ -104,6 +104,15 @@ export const __webpack_modules__ = {
|
|
|
104
104
|
cwd,
|
|
105
105
|
configPath: options.config
|
|
106
106
|
});
|
|
107
|
+
if (rspeedyConfig.performance?.buildCache) if (true === rspeedyConfig.performance.buildCache) rspeedyConfig.performance.buildCache = {
|
|
108
|
+
buildDependencies: [
|
|
109
|
+
configPath
|
|
110
|
+
]
|
|
111
|
+
};
|
|
112
|
+
else {
|
|
113
|
+
rspeedyConfig.performance.buildCache.buildDependencies ??= [];
|
|
114
|
+
rspeedyConfig.performance.buildCache.buildDependencies.push(configPath);
|
|
115
|
+
}
|
|
107
116
|
const createRspeedyOptions = {
|
|
108
117
|
cwd,
|
|
109
118
|
rspeedyConfig
|
|
@@ -134,7 +143,8 @@ export const __webpack_modules__ = {
|
|
|
134
143
|
function applyDefaultRspeedyConfig(config) {
|
|
135
144
|
const ret = (0, core_.mergeRsbuildConfig)({
|
|
136
145
|
output: {
|
|
137
|
-
filename: getFilename(config.output?.filename)
|
|
146
|
+
filename: getFilename(config.output?.filename),
|
|
147
|
+
inlineScripts: true
|
|
138
148
|
},
|
|
139
149
|
tools: {
|
|
140
150
|
rsdoctor: {
|
|
@@ -233,6 +243,7 @@ export const __webpack_modules__ = {
|
|
|
233
243
|
entry: toRsbuildEntry(config.source?.entry),
|
|
234
244
|
exclude: config.source?.exclude,
|
|
235
245
|
include: config.source?.include,
|
|
246
|
+
preEntry: config.source?.preEntry,
|
|
236
247
|
transformImport: config.source?.transformImport,
|
|
237
248
|
tsconfigPath: config.source?.tsconfigPath
|
|
238
249
|
},
|
|
@@ -245,6 +256,7 @@ export const __webpack_modules__ = {
|
|
|
245
256
|
},
|
|
246
257
|
plugins: config.plugins,
|
|
247
258
|
performance: {
|
|
259
|
+
buildCache: config.performance?.buildCache,
|
|
248
260
|
chunkSplit: config.performance?.chunkSplit,
|
|
249
261
|
profile: config.performance?.profile,
|
|
250
262
|
removeConsole: toRsbuildRemoveConsole(config),
|
|
@@ -272,14 +284,15 @@ export const __webpack_modules__ = {
|
|
|
272
284
|
];
|
|
273
285
|
return config.performance?.removeConsole;
|
|
274
286
|
}
|
|
275
|
-
async function createRspeedy({ cwd = process.cwd(), rspeedyConfig = {}, loadEnv = true, environment = [] }) {
|
|
287
|
+
async function createRspeedy({ cwd = process.cwd(), rspeedyConfig = {}, loadEnv = true, environment = [], callerName = 'rspeedy' }) {
|
|
276
288
|
const config = applyDefaultRspeedyConfig(rspeedyConfig);
|
|
277
289
|
const [rspeedy, { applyDefaultPlugins }] = await Promise.all([
|
|
278
290
|
(0, core_.createRsbuild)({
|
|
279
291
|
cwd,
|
|
280
292
|
loadEnv,
|
|
281
293
|
rsbuildConfig: toRsbuildConfig(config),
|
|
282
|
-
environment
|
|
294
|
+
environment,
|
|
295
|
+
callerName
|
|
283
296
|
}),
|
|
284
297
|
__webpack_require__.e("src_plugins_index_ts").then(__webpack_require__.bind(__webpack_require__, "./src/plugins/index.ts"))
|
|
285
298
|
]);
|
|
@@ -40,7 +40,7 @@ export const __webpack_modules__ = {
|
|
|
40
40
|
});
|
|
41
41
|
var core_ = __webpack_require__("@rsbuild/core");
|
|
42
42
|
var package_namespaceObject = {
|
|
43
|
-
i8: "0.9.
|
|
43
|
+
i8: "0.9.6"
|
|
44
44
|
};
|
|
45
45
|
const version = package_namespaceObject.i8;
|
|
46
46
|
const rspackVersion = core_.rspack.rspackVersion;
|
package/dist/src_cli_dev_ts.js
CHANGED
|
@@ -17,7 +17,7 @@ export const __webpack_modules__ = {
|
|
|
17
17
|
async function dev(cwd, devOptions) {
|
|
18
18
|
let onBeforeRestart = [];
|
|
19
19
|
try {
|
|
20
|
-
const { rspeedyConfig, configPath, createRspeedyOptions } = await (0, _init_js__WEBPACK_IMPORTED_MODULE_4__.
|
|
20
|
+
const { rspeedyConfig, configPath, createRspeedyOptions } = await (0, _init_js__WEBPACK_IMPORTED_MODULE_4__.init)(cwd, devOptions);
|
|
21
21
|
const watchedFiles = [
|
|
22
22
|
configPath
|
|
23
23
|
];
|
|
@@ -70,7 +70,7 @@ export const __webpack_modules__ = {
|
|
|
70
70
|
},
|
|
71
71
|
"./src/cli/init.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
72
72
|
__webpack_require__.d(__webpack_exports__, {
|
|
73
|
-
|
|
73
|
+
init: ()=>init
|
|
74
74
|
});
|
|
75
75
|
var external_node_fs_ = __webpack_require__("node:fs");
|
|
76
76
|
var external_node_path_ = __webpack_require__("node:path");
|
|
@@ -147,6 +147,15 @@ export const __webpack_modules__ = {
|
|
|
147
147
|
cwd,
|
|
148
148
|
configPath: options.config
|
|
149
149
|
});
|
|
150
|
+
if (rspeedyConfig.performance?.buildCache) if (true === rspeedyConfig.performance.buildCache) rspeedyConfig.performance.buildCache = {
|
|
151
|
+
buildDependencies: [
|
|
152
|
+
configPath
|
|
153
|
+
]
|
|
154
|
+
};
|
|
155
|
+
else {
|
|
156
|
+
rspeedyConfig.performance.buildCache.buildDependencies ??= [];
|
|
157
|
+
rspeedyConfig.performance.buildCache.buildDependencies.push(configPath);
|
|
158
|
+
}
|
|
150
159
|
const createRspeedyOptions = {
|
|
151
160
|
cwd,
|
|
152
161
|
rspeedyConfig
|
|
@@ -177,7 +186,8 @@ export const __webpack_modules__ = {
|
|
|
177
186
|
function applyDefaultRspeedyConfig(config) {
|
|
178
187
|
const ret = (0, core_.mergeRsbuildConfig)({
|
|
179
188
|
output: {
|
|
180
|
-
filename: getFilename(config.output?.filename)
|
|
189
|
+
filename: getFilename(config.output?.filename),
|
|
190
|
+
inlineScripts: true
|
|
181
191
|
},
|
|
182
192
|
tools: {
|
|
183
193
|
rsdoctor: {
|
|
@@ -276,6 +286,7 @@ export const __webpack_modules__ = {
|
|
|
276
286
|
entry: toRsbuildEntry(config.source?.entry),
|
|
277
287
|
exclude: config.source?.exclude,
|
|
278
288
|
include: config.source?.include,
|
|
289
|
+
preEntry: config.source?.preEntry,
|
|
279
290
|
transformImport: config.source?.transformImport,
|
|
280
291
|
tsconfigPath: config.source?.tsconfigPath
|
|
281
292
|
},
|
|
@@ -288,6 +299,7 @@ export const __webpack_modules__ = {
|
|
|
288
299
|
},
|
|
289
300
|
plugins: config.plugins,
|
|
290
301
|
performance: {
|
|
302
|
+
buildCache: config.performance?.buildCache,
|
|
291
303
|
chunkSplit: config.performance?.chunkSplit,
|
|
292
304
|
profile: config.performance?.profile,
|
|
293
305
|
removeConsole: toRsbuildRemoveConsole(config),
|
|
@@ -315,14 +327,15 @@ export const __webpack_modules__ = {
|
|
|
315
327
|
];
|
|
316
328
|
return config.performance?.removeConsole;
|
|
317
329
|
}
|
|
318
|
-
async function createRspeedy({ cwd = process.cwd(), rspeedyConfig = {}, loadEnv = true, environment = [] }) {
|
|
330
|
+
async function createRspeedy({ cwd = process.cwd(), rspeedyConfig = {}, loadEnv = true, environment = [], callerName = 'rspeedy' }) {
|
|
319
331
|
const config = applyDefaultRspeedyConfig(rspeedyConfig);
|
|
320
332
|
const [rspeedy, { applyDefaultPlugins }] = await Promise.all([
|
|
321
333
|
(0, core_.createRsbuild)({
|
|
322
334
|
cwd,
|
|
323
335
|
loadEnv,
|
|
324
336
|
rsbuildConfig: toRsbuildConfig(config),
|
|
325
|
-
environment
|
|
337
|
+
environment,
|
|
338
|
+
callerName
|
|
326
339
|
}),
|
|
327
340
|
__webpack_require__.e("src_plugins_index_ts").then(__webpack_require__.bind(__webpack_require__, "./src/plugins/index.ts"))
|
|
328
341
|
]);
|