@lynx-js/react-alias-rsbuild-plugin 0.11.4 → 0.12.1
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 +19 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +25 -24
- package/package.json +5 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @lynx-js/react-alias-rsbuild-plugin
|
|
2
2
|
|
|
3
|
+
## 0.12.1
|
|
4
|
+
|
|
5
|
+
## 0.12.0
|
|
6
|
+
|
|
7
|
+
### Minor Changes
|
|
8
|
+
|
|
9
|
+
- **BREAKING CHANGE**: Use resolver from Rspack. ([#1964](https://github.com/lynx-family/lynx-stack/pull/1964))
|
|
10
|
+
|
|
11
|
+
The `createLazyResolver` now requires an `rspack` parameter:
|
|
12
|
+
|
|
13
|
+
```diff
|
|
14
|
+
- function createLazyResolver(directory: string, conditionNames: string[]): (request: string) => Promise<string>;
|
|
15
|
+
+ function createLazyResolver(rspack: rspack, directory: string, conditionNames: string[]): (request: string) => Promise<string>;
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- Support Yarn Plug'n'Play. ([#1964](https://github.com/lynx-family/lynx-stack/pull/1964))
|
|
21
|
+
|
|
3
22
|
## 0.11.4
|
|
4
23
|
|
|
5
24
|
## 0.11.3
|
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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
2
|
import node_path from "node:path";
|
|
3
3
|
var __webpack_modules__ = {
|
|
4
|
-
"../../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/classes/semver.js"
|
|
4
|
+
"../../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/classes/semver.js" (module, __unused_webpack_exports, __webpack_require__) {
|
|
5
5
|
const debug = __webpack_require__("../../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/debug.js");
|
|
6
6
|
const { MAX_LENGTH, MAX_SAFE_INTEGER } = __webpack_require__("../../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/constants.js");
|
|
7
7
|
const { safeRe: re, t } = __webpack_require__("../../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/re.js");
|
|
@@ -181,17 +181,17 @@ var __webpack_modules__ = {
|
|
|
181
181
|
}
|
|
182
182
|
module.exports = SemVer;
|
|
183
183
|
},
|
|
184
|
-
"../../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/compare.js"
|
|
184
|
+
"../../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/compare.js" (module, __unused_webpack_exports, __webpack_require__) {
|
|
185
185
|
const SemVer = __webpack_require__("../../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/classes/semver.js");
|
|
186
186
|
const compare = (a, b, loose)=>new SemVer(a, loose).compare(new SemVer(b, loose));
|
|
187
187
|
module.exports = compare;
|
|
188
188
|
},
|
|
189
|
-
"../../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/gte.js"
|
|
189
|
+
"../../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/gte.js" (module, __unused_webpack_exports, __webpack_require__) {
|
|
190
190
|
const compare = __webpack_require__("../../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/compare.js");
|
|
191
191
|
const gte = (a, b, loose)=>compare(a, b, loose) >= 0;
|
|
192
192
|
module.exports = gte;
|
|
193
193
|
},
|
|
194
|
-
"../../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/constants.js"
|
|
194
|
+
"../../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/constants.js" (module) {
|
|
195
195
|
const SEMVER_SPEC_VERSION = '2.0.0';
|
|
196
196
|
const MAX_LENGTH = 256;
|
|
197
197
|
const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991;
|
|
@@ -217,11 +217,11 @@ var __webpack_modules__ = {
|
|
|
217
217
|
FLAG_LOOSE: 2
|
|
218
218
|
};
|
|
219
219
|
},
|
|
220
|
-
"../../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/debug.js"
|
|
220
|
+
"../../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/debug.js" (module) {
|
|
221
221
|
const debug = 'object' == typeof process && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args)=>console.error('SEMVER', ...args) : ()=>{};
|
|
222
222
|
module.exports = debug;
|
|
223
223
|
},
|
|
224
|
-
"../../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/identifiers.js"
|
|
224
|
+
"../../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/identifiers.js" (module) {
|
|
225
225
|
const numeric = /^[0-9]+$/;
|
|
226
226
|
const compareIdentifiers = (a, b)=>{
|
|
227
227
|
const anum = numeric.test(a);
|
|
@@ -238,7 +238,7 @@ var __webpack_modules__ = {
|
|
|
238
238
|
rcompareIdentifiers
|
|
239
239
|
};
|
|
240
240
|
},
|
|
241
|
-
"../../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/parse-options.js"
|
|
241
|
+
"../../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/parse-options.js" (module) {
|
|
242
242
|
const looseOption = Object.freeze({
|
|
243
243
|
loose: true
|
|
244
244
|
});
|
|
@@ -250,7 +250,7 @@ var __webpack_modules__ = {
|
|
|
250
250
|
};
|
|
251
251
|
module.exports = parseOptions;
|
|
252
252
|
},
|
|
253
|
-
"../../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/re.js"
|
|
253
|
+
"../../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/re.js" (module, exports, __webpack_require__) {
|
|
254
254
|
const { MAX_SAFE_COMPONENT_LENGTH, MAX_SAFE_BUILD_LENGTH, MAX_LENGTH } = __webpack_require__("../../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/constants.js");
|
|
255
255
|
const debug = __webpack_require__("../../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/debug.js");
|
|
256
256
|
exports = module.exports = {};
|
|
@@ -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",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.1",
|
|
4
4
|
"description": "A rsbuild plugin for making alias in ReactLynx",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"rsbuild",
|
|
@@ -31,16 +31,14 @@
|
|
|
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
|
-
"@rsbuild/core": "1.
|
|
36
|
+
"@rsbuild/core": "1.6.13",
|
|
37
|
+
"@rspack/core": "1.6.6",
|
|
40
38
|
"@types/semver": "^7.7.1",
|
|
41
39
|
"semver": "^7.7.2",
|
|
42
|
-
"@lynx-js/react": "0.
|
|
43
|
-
"@lynx-js/react-webpack-plugin": "0.7.
|
|
40
|
+
"@lynx-js/react": "0.115.1",
|
|
41
|
+
"@lynx-js/react-webpack-plugin": "0.7.3",
|
|
44
42
|
"@lynx-js/vitest-setup": "0.0.0"
|
|
45
43
|
},
|
|
46
44
|
"engines": {
|