@lynx-js/react-alias-rsbuild-plugin-canary 0.12.0-canary-20251129-2cd5c0c8 → 0.12.0-canary-20251201-738d44d6

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,6 +1,21 @@
1
1
  # @lynx-js/react-alias-rsbuild-plugin
2
2
 
3
- ## 0.12.0-canary-20251129025626-2cd5c0c8d7c2e054c427d21763b420280c06d845
3
+ ## 0.12.0-canary-20251201075617-738d44d685870d7c3f64a1be7139e8d7af498feb
4
+
5
+ ### Minor Changes
6
+
7
+ - **BREAKING CHANGE**: Use resolver from Rspack. ([#1964](https://github.com/lynx-family/lynx-stack/pull/1964))
8
+
9
+ The `createLazyResolver` now requires an `rspack` parameter:
10
+
11
+ ```diff
12
+ - function createLazyResolver(directory: string, conditionNames: string[]): (request: string) => Promise<string>;
13
+ + function createLazyResolver(rspack: rspack, directory: string, conditionNames: string[]): (request: string) => Promise<string>;
14
+ ```
15
+
16
+ ### Patch Changes
17
+
18
+ - Support Yarn Plug'n'Play. ([#1964](https://github.com/lynx-family/lynx-stack/pull/1964))
4
19
 
5
20
  ## 0.11.4
6
21
 
package/dist/index.d.ts CHANGED
@@ -8,4 +8,4 @@ export interface Options {
8
8
  rootPath?: string | undefined;
9
9
  }
10
10
  export declare function pluginReactAlias(options: Options): RsbuildPlugin;
11
- export declare function createLazyResolver(directory: string, conditionNames: string[]): (request: string) => Promise<string>;
11
+ export declare function createLazyResolver(rspack: typeof import('@rspack/core').rspack, directory: string, conditionNames: string[]): (request: string) => Promise<string>;
package/dist/index.js CHANGED
@@ -383,18 +383,6 @@ function pluginReactAlias(options) {
383
383
  });
384
384
  const { version } = require(reactLynxPkg);
385
385
  const reactLynxDir = node_path.dirname(reactLynxPkg);
386
- const resolve = createLazyResolver(rootPath ?? api.context.rootPath, lazy ? [
387
- 'lazy',
388
- 'import'
389
- ] : [
390
- 'import'
391
- ]);
392
- const resolvePreact = createLazyResolver(reactLynxDir, [
393
- 'import'
394
- ]);
395
- api.expose(Symbol.for('@lynx-js/react/internal:resolve'), {
396
- resolve
397
- });
398
386
  api.modifyRsbuildConfig((config, { mergeRsbuildConfig })=>mergeRsbuildConfig(config, {
399
387
  source: {
400
388
  include: [
@@ -402,8 +390,20 @@ function pluginReactAlias(options) {
402
390
  ]
403
391
  }
404
392
  }));
405
- api.modifyBundlerChain(async (chain, { isProd, environment })=>{
393
+ api.modifyBundlerChain(async (chain, { isProd, environment, rspack })=>{
406
394
  if (Object.hasOwn(environment, S_PLUGIN_REACT_ALIAS)) return;
395
+ const resolve = createLazyResolver(rspack, rootPath ?? api.context.rootPath, lazy ? [
396
+ 'lazy',
397
+ 'import'
398
+ ] : [
399
+ 'import'
400
+ ]);
401
+ const resolvePreact = createLazyResolver(rspack, reactLynxDir, [
402
+ 'import'
403
+ ]);
404
+ api.expose(Symbol.for('@lynx-js/react/internal:resolve'), {
405
+ resolve
406
+ });
407
407
  Object.defineProperty(environment, S_PLUGIN_REACT_ALIAS, {
408
408
  value: true
409
409
  });
@@ -469,16 +469,17 @@ function pluginReactAlias(options) {
469
469
  }
470
470
  };
471
471
  }
472
- function createLazyResolver(directory, conditionNames) {
472
+ function createLazyResolver(rspack, directory, conditionNames) {
473
+ const { ResolverFactory } = rspack.experiments.resolver;
473
474
  let lazyExports;
474
475
  let resolverLazy;
475
476
  return async (request)=>{
476
477
  if (!lazyExports) lazyExports = {};
477
478
  if (void 0 === lazyExports[request]) {
478
479
  if (!resolverLazy) {
479
- const { ResolverFactory } = await import("unrs-resolver");
480
480
  const resolver = new ResolverFactory({
481
- conditionNames
481
+ conditionNames,
482
+ enablePnp: true
482
483
  });
483
484
  resolverLazy = (dir, req)=>resolver.sync(dir, req);
484
485
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynx-js/react-alias-rsbuild-plugin-canary",
3
- "version": "0.12.0-canary-20251129-2cd5c0c8",
3
+ "version": "0.12.0-canary-20251201-738d44d6",
4
4
  "description": "A rsbuild plugin for making alias in ReactLynx",
5
5
  "keywords": [
6
6
  "rsbuild",
@@ -31,17 +31,15 @@
31
31
  "CHANGELOG.md",
32
32
  "README.md"
33
33
  ],
34
- "dependencies": {
35
- "unrs-resolver": "1.11.1"
36
- },
37
34
  "devDependencies": {
38
35
  "@microsoft/api-extractor": "7.52.15",
39
36
  "@rsbuild/core": "1.6.9",
37
+ "@rspack/core": "1.6.5",
40
38
  "@types/semver": "^7.7.1",
41
39
  "semver": "^7.7.2",
42
- "@lynx-js/react": "npm:@lynx-js/react-canary@0.114.6-canary-20251129-2cd5c0c8",
43
- "@lynx-js/vitest-setup": "0.0.0",
44
- "@lynx-js/react-webpack-plugin": "npm:@lynx-js/react-webpack-plugin-canary@0.7.2"
40
+ "@lynx-js/react": "npm:@lynx-js/react-canary@0.114.6-canary-20251201-738d44d6",
41
+ "@lynx-js/react-webpack-plugin": "npm:@lynx-js/react-webpack-plugin-canary@0.7.2",
42
+ "@lynx-js/vitest-setup": "0.0.0"
45
43
  },
46
44
  "engines": {
47
45
  "node": ">=18"