@lynx-js/rspeedy-canary 0.11.7 → 0.11.8-canary-20251029-96545dd9
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
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @lynx-js/rspeedy
|
|
2
2
|
|
|
3
|
+
## 0.11.8-canary-20251029071231-96545dd9f966c07aa64437aefc781a9f3e260861
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- feat: support web preview in rspeedy dev ([#1891](https://github.com/lynx-family/lynx-stack/pull/1891))
|
|
8
|
+
|
|
9
|
+
- print URLs with labels
|
|
10
|
+
|
|
3
11
|
## 0.11.7
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -58,11 +66,11 @@
|
|
|
58
66
|
- Support `command` and `env` parameters in the function exported by `lynx.config.js`. ([#1669](https://github.com/lynx-family/lynx-stack/pull/1669))
|
|
59
67
|
|
|
60
68
|
```js
|
|
61
|
-
import { defineConfig } from
|
|
69
|
+
import { defineConfig } from "@lynx-js/rspeedy";
|
|
62
70
|
|
|
63
71
|
export default defineConfig(({ command, env }) => {
|
|
64
|
-
const isBuild = command ===
|
|
65
|
-
const isTest = env ===
|
|
72
|
+
const isBuild = command === "build";
|
|
73
|
+
const isTest = env === "test";
|
|
66
74
|
|
|
67
75
|
return {
|
|
68
76
|
output: {
|
|
@@ -71,8 +79,8 @@
|
|
|
71
79
|
performance: {
|
|
72
80
|
buildCache: isBuild,
|
|
73
81
|
},
|
|
74
|
-
}
|
|
75
|
-
})
|
|
82
|
+
};
|
|
83
|
+
});
|
|
76
84
|
```
|
|
77
85
|
|
|
78
86
|
- Support `resolve.dedupe`. ([#1671](https://github.com/lynx-family/lynx-stack/pull/1671))
|
|
@@ -80,30 +88,30 @@
|
|
|
80
88
|
This is useful when having multiple duplicated packages in the bundle:
|
|
81
89
|
|
|
82
90
|
```js
|
|
83
|
-
import { defineConfig } from
|
|
91
|
+
import { defineConfig } from "@lynx-js/rspeedy";
|
|
84
92
|
|
|
85
93
|
export default defineConfig({
|
|
86
94
|
resolve: {
|
|
87
|
-
dedupe: [
|
|
95
|
+
dedupe: ["tslib"],
|
|
88
96
|
},
|
|
89
|
-
})
|
|
97
|
+
});
|
|
90
98
|
```
|
|
91
99
|
|
|
92
100
|
- Support `resolve.aliasStrategy` for controlling priority between `tsconfig.json` paths and `resolve.alias` ([#1722](https://github.com/lynx-family/lynx-stack/pull/1722))
|
|
93
101
|
|
|
94
102
|
```js
|
|
95
|
-
import { defineConfig } from
|
|
103
|
+
import { defineConfig } from "@lynx-js/rspeedy";
|
|
96
104
|
|
|
97
105
|
export default defineConfig({
|
|
98
106
|
resolve: {
|
|
99
107
|
alias: {
|
|
100
|
-
|
|
108
|
+
"@": "./src",
|
|
101
109
|
},
|
|
102
110
|
// 'prefer-tsconfig' (default): tsconfig.json paths take priority
|
|
103
111
|
// 'prefer-alias': resolve.alias takes priority
|
|
104
|
-
aliasStrategy:
|
|
112
|
+
aliasStrategy: "prefer-alias",
|
|
105
113
|
},
|
|
106
|
-
})
|
|
114
|
+
});
|
|
107
115
|
```
|
|
108
116
|
|
|
109
117
|
- Bump Rsbuild v1.5.4 with Rspack v1.5.2. ([#1644](https://github.com/lynx-family/lynx-stack/pull/1644))
|
|
@@ -123,7 +131,7 @@
|
|
|
123
131
|
- Add `output.dataUriLimit.*` for fine-grained control of asset inlining. ([#1648](https://github.com/lynx-family/lynx-stack/pull/1648))
|
|
124
132
|
|
|
125
133
|
```js
|
|
126
|
-
import { defineConfig } from
|
|
134
|
+
import { defineConfig } from "@lynx-js/rspeedy";
|
|
127
135
|
|
|
128
136
|
export default defineConfig({
|
|
129
137
|
output: {
|
|
@@ -132,7 +140,7 @@
|
|
|
132
140
|
media: 0,
|
|
133
141
|
},
|
|
134
142
|
},
|
|
135
|
-
})
|
|
143
|
+
});
|
|
136
144
|
```
|
|
137
145
|
|
|
138
146
|
## 0.11.0
|
|
@@ -252,28 +260,28 @@
|
|
|
252
260
|
|
|
253
261
|
```ts
|
|
254
262
|
type InlineChunkTestFunction = (params: {
|
|
255
|
-
size: number
|
|
256
|
-
name: string
|
|
257
|
-
}) => boolean
|
|
263
|
+
size: number;
|
|
264
|
+
name: string;
|
|
265
|
+
}) => boolean;
|
|
258
266
|
|
|
259
|
-
type InlineChunkTest = RegExp | InlineChunkTestFunction
|
|
267
|
+
type InlineChunkTest = RegExp | InlineChunkTestFunction;
|
|
260
268
|
|
|
261
269
|
type InlineChunkConfig =
|
|
262
270
|
| boolean
|
|
263
271
|
| InlineChunkTest
|
|
264
|
-
| { enable?: boolean |
|
|
272
|
+
| { enable?: boolean | "auto"; test: InlineChunkTest };
|
|
265
273
|
```
|
|
266
274
|
|
|
267
275
|
```ts
|
|
268
|
-
import { defineConfig } from
|
|
276
|
+
import { defineConfig } from "@lynx-js/rspeedy";
|
|
269
277
|
|
|
270
278
|
export default defineConfig({
|
|
271
279
|
output: {
|
|
272
280
|
inlineScripts: ({ name, size }) => {
|
|
273
|
-
return name.includes(
|
|
281
|
+
return name.includes("foo") && size < 1000;
|
|
274
282
|
},
|
|
275
283
|
},
|
|
276
|
-
})
|
|
284
|
+
});
|
|
277
285
|
```
|
|
278
286
|
|
|
279
287
|
- docs: remove chunks: 'all' in comments ([#1168](https://github.com/lynx-family/lynx-stack/pull/1168))
|
|
@@ -316,13 +324,13 @@
|
|
|
316
324
|
example:
|
|
317
325
|
|
|
318
326
|
```js
|
|
319
|
-
import { defineConfig } from
|
|
327
|
+
import { defineConfig } from "@lynx-js/rspeedy";
|
|
320
328
|
|
|
321
329
|
export default defineConfig({
|
|
322
330
|
output: {
|
|
323
331
|
inlineScripts: false,
|
|
324
332
|
},
|
|
325
|
-
})
|
|
333
|
+
});
|
|
326
334
|
```
|
|
327
335
|
|
|
328
336
|
- Bump Rsbuild v1.3.21 with Rspack v1.3.11. ([#863](https://github.com/lynx-family/lynx-stack/pull/863))
|
|
@@ -342,12 +350,12 @@
|
|
|
342
350
|
example:
|
|
343
351
|
|
|
344
352
|
```js
|
|
345
|
-
import { defineConfig } from
|
|
353
|
+
import { defineConfig } from "@lynx-js/rspeedy";
|
|
346
354
|
export default defineConfig({
|
|
347
355
|
source: {
|
|
348
|
-
preEntry:
|
|
356
|
+
preEntry: "./src/polyfill.ts",
|
|
349
357
|
},
|
|
350
|
-
})
|
|
358
|
+
});
|
|
351
359
|
```
|
|
352
360
|
|
|
353
361
|
- Bump Rsbuild v1.3.20 with Rspack v1.3.10. ([#799](https://github.com/lynx-family/lynx-stack/pull/799))
|
|
@@ -358,17 +366,17 @@
|
|
|
358
366
|
|
|
359
367
|
```js
|
|
360
368
|
export const myPlugin = {
|
|
361
|
-
name:
|
|
369
|
+
name: "my-plugin",
|
|
362
370
|
setup(api) {
|
|
363
|
-
const { callerName } = api.context
|
|
371
|
+
const { callerName } = api.context;
|
|
364
372
|
|
|
365
|
-
if (callerName ===
|
|
373
|
+
if (callerName === "rslib") {
|
|
366
374
|
// ...
|
|
367
|
-
} else if (callerName ===
|
|
375
|
+
} else if (callerName === "rspeedy") {
|
|
368
376
|
// ...
|
|
369
377
|
}
|
|
370
378
|
},
|
|
371
|
-
}
|
|
379
|
+
};
|
|
372
380
|
```
|
|
373
381
|
|
|
374
382
|
- Support `performance.buildCache`. ([#766](https://github.com/lynx-family/lynx-stack/pull/766))
|
|
@@ -391,7 +399,7 @@
|
|
|
391
399
|
Set `tools.rsdoctor.experiments.enableNativePlugin` to `false` to use the old JS plugin.
|
|
392
400
|
|
|
393
401
|
```js
|
|
394
|
-
import { defineConfig } from
|
|
402
|
+
import { defineConfig } from "@lynx-js/rspeedy";
|
|
395
403
|
|
|
396
404
|
export default defineConfig({
|
|
397
405
|
tools: {
|
|
@@ -401,7 +409,7 @@
|
|
|
401
409
|
},
|
|
402
410
|
},
|
|
403
411
|
},
|
|
404
|
-
})
|
|
412
|
+
});
|
|
405
413
|
```
|
|
406
414
|
|
|
407
415
|
See [Rsdoctor - 1.0](https://rsdoctor.dev/blog/release/release-note-1_0#-faster-analysis) for more details.
|
|
@@ -533,12 +541,12 @@
|
|
|
533
541
|
example:
|
|
534
542
|
|
|
535
543
|
```js
|
|
536
|
-
import { defineConfig } from
|
|
544
|
+
import { defineConfig } from "@lynx-js/rspeedy";
|
|
537
545
|
export default defineConfig({
|
|
538
546
|
server: {
|
|
539
|
-
base:
|
|
547
|
+
base: "/dist",
|
|
540
548
|
},
|
|
541
|
-
})
|
|
549
|
+
});
|
|
542
550
|
```
|
|
543
551
|
|
|
544
552
|
- Updated dependencies [[`b026c8b`](https://github.com/lynx-family/lynx-stack/commit/b026c8bdcbf7bdcda73e170477297213b447d876)]:
|
|
@@ -591,11 +599,11 @@
|
|
|
591
599
|
You can switch to other tools by using:
|
|
592
600
|
|
|
593
601
|
```js
|
|
594
|
-
import { defineConfig } from
|
|
602
|
+
import { defineConfig } from "@lynx-js/rspeedy";
|
|
595
603
|
import {
|
|
596
604
|
CssMinimizerWebpackPlugin,
|
|
597
605
|
pluginCssMinimizer,
|
|
598
|
-
} from
|
|
606
|
+
} from "@rsbuild/plugin-css-minimizer";
|
|
599
607
|
|
|
600
608
|
export default defineConfig({
|
|
601
609
|
plugins: [
|
|
@@ -608,7 +616,7 @@
|
|
|
608
616
|
},
|
|
609
617
|
}),
|
|
610
618
|
],
|
|
611
|
-
})
|
|
619
|
+
});
|
|
612
620
|
```
|
|
613
621
|
|
|
614
622
|
See [@rsbuild/plugin-css-minimizer](https://github.com/rspack-contrib/rsbuild-plugin-css-minimizer) for details.
|
|
@@ -618,8 +626,8 @@
|
|
|
618
626
|
You can use custom options with [@rsbuild/plugin-css-minimizer](https://github.com/rspack-contrib/rsbuild-plugin-css-minimizer):
|
|
619
627
|
|
|
620
628
|
```js
|
|
621
|
-
import { defineConfig } from
|
|
622
|
-
import { pluginCssMinimizer } from
|
|
629
|
+
import { defineConfig } from "@lynx-js/rspeedy";
|
|
630
|
+
import { pluginCssMinimizer } from "@rsbuild/plugin-css-minimizer";
|
|
623
631
|
|
|
624
632
|
export default defineConfig({
|
|
625
633
|
plugins: [
|
|
@@ -631,7 +639,7 @@
|
|
|
631
639
|
},
|
|
632
640
|
}),
|
|
633
641
|
],
|
|
634
|
-
})
|
|
642
|
+
});
|
|
635
643
|
```
|
|
636
644
|
|
|
637
645
|
## 0.7.1
|
|
@@ -651,7 +659,7 @@
|
|
|
651
659
|
You may turn it off using `output.minify.css: false`:
|
|
652
660
|
|
|
653
661
|
```js
|
|
654
|
-
import { defineConfig } from
|
|
662
|
+
import { defineConfig } from "@lynx-js/rspeedy";
|
|
655
663
|
|
|
656
664
|
export default defineConfig({
|
|
657
665
|
output: {
|
|
@@ -659,18 +667,18 @@
|
|
|
659
667
|
css: false,
|
|
660
668
|
},
|
|
661
669
|
},
|
|
662
|
-
})
|
|
670
|
+
});
|
|
663
671
|
```
|
|
664
672
|
|
|
665
673
|
Or you may use [@rsbuild/plugin-css-minimizer](https://github.com/rspack-contrib/rsbuild-plugin-css-minimizer) to use `cssnano` as CSS minimizer.
|
|
666
674
|
|
|
667
675
|
```js
|
|
668
|
-
import { defineConfig } from
|
|
669
|
-
import { pluginCssMinimizer } from
|
|
676
|
+
import { defineConfig } from "@lynx-js/rspeedy";
|
|
677
|
+
import { pluginCssMinimizer } from "@rsbuild/plugin-css-minimizer";
|
|
670
678
|
|
|
671
679
|
export default defineConfig({
|
|
672
680
|
plugins: [pluginCssMinimizer()],
|
|
673
|
-
})
|
|
681
|
+
});
|
|
674
682
|
```
|
|
675
683
|
|
|
676
684
|
- 525554c: **BREAKING CHANGE**: Bump ts-blank-space to ^0.6.0.
|
|
@@ -697,22 +705,22 @@
|
|
|
697
705
|
- The new `type: 'reload-server'` will restart the development server when it detects changes in the specified files.
|
|
698
706
|
|
|
699
707
|
```js
|
|
700
|
-
import { defineConfig } from
|
|
708
|
+
import { defineConfig } from "@lynx-js/rspeedy";
|
|
701
709
|
|
|
702
710
|
export default defineConfig({
|
|
703
711
|
dev: {
|
|
704
712
|
watchFiles: [
|
|
705
713
|
{
|
|
706
|
-
type:
|
|
707
|
-
paths: [
|
|
714
|
+
type: "reload-server",
|
|
715
|
+
paths: ["public/**/*.txt"],
|
|
708
716
|
},
|
|
709
717
|
{
|
|
710
|
-
type:
|
|
711
|
-
paths: [
|
|
718
|
+
type: "reload-page",
|
|
719
|
+
paths: ["public/**/*.json"],
|
|
712
720
|
},
|
|
713
721
|
],
|
|
714
722
|
},
|
|
715
|
-
})
|
|
723
|
+
});
|
|
716
724
|
```
|
|
717
725
|
|
|
718
726
|
- be9b003: Add `source.exclude`.
|
|
@@ -77,6 +77,41 @@ export const __webpack_modules__ = {
|
|
|
77
77
|
assetPrefix
|
|
78
78
|
}
|
|
79
79
|
}));
|
|
80
|
+
api.modifyRsbuildConfig((config, { mergeRsbuildConfig })=>{
|
|
81
|
+
const rspeedyAPIs = api.useExposed(Symbol.for('rspeedy.api'));
|
|
82
|
+
const defaultFilename = '[name].[platform].bundle';
|
|
83
|
+
const { filename } = rspeedyAPIs.config.output ?? {};
|
|
84
|
+
let name;
|
|
85
|
+
name = filename ? 'object' == typeof filename ? filename.bundle ?? filename.template ?? defaultFilename : filename : defaultFilename;
|
|
86
|
+
if (config.server?.printUrls === void 0 || config.server?.printUrls === true) {
|
|
87
|
+
const environmentNames = Object.keys(config.environments ?? {});
|
|
88
|
+
return mergeRsbuildConfig(config, {
|
|
89
|
+
server: {
|
|
90
|
+
printUrls: (param)=>{
|
|
91
|
+
const finalUrls = [];
|
|
92
|
+
const baseForUrls = ('string' == typeof assetPrefix ? assetPrefix : `http://${hostname}:<port>/`).replaceAll('<port>', String(param.port));
|
|
93
|
+
for (const entry of Object.keys(config.source?.entry ?? {}))for (const environmentName of environmentNames){
|
|
94
|
+
const pathname = name.replaceAll('[name]', entry).replaceAll('[platform]', environmentName);
|
|
95
|
+
finalUrls.push({
|
|
96
|
+
label: environmentName,
|
|
97
|
+
url: new URL(pathname, baseForUrls).toString()
|
|
98
|
+
});
|
|
99
|
+
if ('web' === environmentName) finalUrls.push({
|
|
100
|
+
label: "Web Preview",
|
|
101
|
+
url: new URL(`/__web_preview?casename=${encodeURIComponent(pathname)}`, baseForUrls).toString()
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
return finalUrls.map((urlInfo)=>{
|
|
105
|
+
const label = urlInfo.label.charAt(0).toUpperCase() + urlInfo.label.slice(1);
|
|
106
|
+
urlInfo.label = label;
|
|
107
|
+
return urlInfo;
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
return config;
|
|
114
|
+
});
|
|
80
115
|
const require = createRequire(import.meta.url);
|
|
81
116
|
api.modifyBundlerChain((chain, { isDev, environment })=>{
|
|
82
117
|
const { action } = api.context;
|
|
@@ -77,6 +77,41 @@ export const __webpack_modules__ = {
|
|
|
77
77
|
assetPrefix
|
|
78
78
|
}
|
|
79
79
|
}));
|
|
80
|
+
api.modifyRsbuildConfig((config, { mergeRsbuildConfig })=>{
|
|
81
|
+
const rspeedyAPIs = api.useExposed(Symbol.for('rspeedy.api'));
|
|
82
|
+
const defaultFilename = '[name].[platform].bundle';
|
|
83
|
+
const { filename } = rspeedyAPIs.config.output ?? {};
|
|
84
|
+
let name;
|
|
85
|
+
name = filename ? 'object' == typeof filename ? filename.bundle ?? filename.template ?? defaultFilename : filename : defaultFilename;
|
|
86
|
+
if (config.server?.printUrls === void 0 || config.server?.printUrls === true) {
|
|
87
|
+
const environmentNames = Object.keys(config.environments ?? {});
|
|
88
|
+
return mergeRsbuildConfig(config, {
|
|
89
|
+
server: {
|
|
90
|
+
printUrls: (param)=>{
|
|
91
|
+
const finalUrls = [];
|
|
92
|
+
const baseForUrls = ('string' == typeof assetPrefix ? assetPrefix : `http://${hostname}:<port>/`).replaceAll('<port>', String(param.port));
|
|
93
|
+
for (const entry of Object.keys(config.source?.entry ?? {}))for (const environmentName of environmentNames){
|
|
94
|
+
const pathname = name.replaceAll('[name]', entry).replaceAll('[platform]', environmentName);
|
|
95
|
+
finalUrls.push({
|
|
96
|
+
label: environmentName,
|
|
97
|
+
url: new URL(pathname, baseForUrls).toString()
|
|
98
|
+
});
|
|
99
|
+
if ('web' === environmentName) finalUrls.push({
|
|
100
|
+
label: "Web Preview",
|
|
101
|
+
url: new URL(`/__web_preview?casename=${encodeURIComponent(pathname)}`, baseForUrls).toString()
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
return finalUrls.map((urlInfo)=>{
|
|
105
|
+
const label = urlInfo.label.charAt(0).toUpperCase() + urlInfo.label.slice(1);
|
|
106
|
+
urlInfo.label = label;
|
|
107
|
+
return urlInfo;
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
return config;
|
|
114
|
+
});
|
|
80
115
|
const require = createRequire(import.meta.url);
|
|
81
116
|
api.modifyBundlerChain((chain, { isDev, environment })=>{
|
|
82
117
|
const { action } = api.context;
|