@lynx-js/react-alias-rsbuild-plugin 0.10.12 → 0.10.14

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,31 @@
1
1
  # @lynx-js/react-alias-rsbuild-plugin
2
2
 
3
+ ## 0.10.14
4
+
5
+ ### Patch Changes
6
+
7
+ - Allow customization of the react$ alias. ([#1653](https://github.com/lynx-family/lynx-stack/pull/1653))
8
+
9
+ ```js
10
+ import { defineConfig } from '@lynx-js/rspeedy'
11
+
12
+ export default defineConfig({
13
+ resolve: {
14
+ alias: {
15
+ react$: '@lynx-js/react/compat',
16
+ },
17
+ },
18
+ })
19
+ ```
20
+
21
+ ## 0.10.13
22
+
23
+ ### Patch Changes
24
+
25
+ - Support using multiple times in different environments. ([#1498](https://github.com/lynx-family/lynx-stack/pull/1498))
26
+
27
+ - Alias `@lynx-js/preact-devtools` to `false` to reduce an import of empty webpack module. ([#1593](https://github.com/lynx-family/lynx-stack/pull/1593))
28
+
3
29
  ## 0.10.12
4
30
 
5
31
  ## 0.10.11
package/dist/index.js CHANGED
@@ -375,9 +375,6 @@ function pluginReactAlias(options) {
375
375
  return {
376
376
  name: 'lynx:react-alias',
377
377
  setup (api) {
378
- const hasAlias = api.useExposed(S_PLUGIN_REACT_ALIAS);
379
- if (hasAlias) return;
380
- api.expose(S_PLUGIN_REACT_ALIAS, true);
381
378
  const require = createRequire(import.meta.url);
382
379
  const reactLynxPkg = require.resolve('@lynx-js/react/package.json', {
383
380
  paths: [
@@ -395,6 +392,9 @@ function pluginReactAlias(options) {
395
392
  const resolvePreact = createLazyResolver(reactLynxDir, [
396
393
  'import'
397
394
  ]);
395
+ api.expose(Symbol.for('@lynx-js/react/internal:resolve'), {
396
+ resolve
397
+ });
398
398
  api.modifyRsbuildConfig((config, { mergeRsbuildConfig })=>mergeRsbuildConfig(config, {
399
399
  source: {
400
400
  include: [
@@ -402,7 +402,11 @@ function pluginReactAlias(options) {
402
402
  ]
403
403
  }
404
404
  }));
405
- api.modifyBundlerChain(async (chain, { isProd })=>{
405
+ api.modifyBundlerChain(async (chain, { isProd, environment })=>{
406
+ if (Object.hasOwn(environment, S_PLUGIN_REACT_ALIAS)) return;
407
+ Object.defineProperty(environment, S_PLUGIN_REACT_ALIAS, {
408
+ value: true
409
+ });
406
410
  const [jsxRuntimeBackground, jsxRuntimeMainThread, jsxDevRuntimeBackground, jsxDevRuntimeMainThread, reactLepusBackground, reactLepusMainThread, reactCompat] = await Promise.all([
407
411
  resolve('@lynx-js/react/jsx-runtime'),
408
412
  resolve('@lynx-js/react/lepus/jsx-runtime'),
@@ -435,8 +439,12 @@ function pluginReactAlias(options) {
435
439
  await Promise.all(transformedEntries.map((entry)=>`@lynx-js/react/${entry}`).map((entry)=>resolve(entry).then((value)=>{
436
440
  chain.resolve.alias.set(`${entry}$`, value);
437
441
  })));
438
- if (isProd) chain.resolve.alias.set('@lynx-js/react/debug$', false);
439
- chain.resolve.alias.set('react$', reactLepus.background).set('@lynx-js/react$', reactLepus.background);
442
+ if (isProd) {
443
+ chain.resolve.alias.set('@lynx-js/react/debug$', false);
444
+ chain.resolve.alias.set('@lynx-js/preact-devtools$', false);
445
+ }
446
+ if (!chain.resolve.alias.has('react$')) chain.resolve.alias.set('react$', reactLepus.background);
447
+ chain.resolve.alias.set('@lynx-js/react$', reactLepus.background);
440
448
  if (reactCompat) chain.resolve.alias.set('@lynx-js/react/compat$', reactCompat);
441
449
  const preactEntries = [
442
450
  'preact',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynx-js/react-alias-rsbuild-plugin",
3
- "version": "0.10.12",
3
+ "version": "0.10.14",
4
4
  "description": "A rsbuild plugin for making alias in ReactLynx",
5
5
  "keywords": [
6
6
  "rsbuild",
@@ -35,12 +35,12 @@
35
35
  "unrs-resolver": "1.11.1"
36
36
  },
37
37
  "devDependencies": {
38
- "@microsoft/api-extractor": "7.52.10",
39
- "@rsbuild/core": "1.4.15",
38
+ "@microsoft/api-extractor": "7.52.11",
39
+ "@rsbuild/core": "1.5.4",
40
40
  "@types/semver": "^7.7.0",
41
41
  "semver": "^7.7.2",
42
- "@lynx-js/react": "0.112.3",
43
- "@lynx-js/react-webpack-plugin": "0.6.19",
42
+ "@lynx-js/react": "0.113.0",
43
+ "@lynx-js/react-webpack-plugin": "0.7.0",
44
44
  "@lynx-js/vitest-setup": "0.0.0"
45
45
  },
46
46
  "engines": {