@lynx-js/lynx-bundle-rslib-config-canary 0.1.0 → 0.2.0-canary-20260120-2bc3e7ef

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,11 @@
1
1
  # @lynx-js/lynx-bundle-rslib-config
2
2
 
3
+ ## 0.2.0-canary-20260120114402-2bc3e7ef66dbbb1048e55658219fa3ace5061671
4
+
5
+ ### Minor Changes
6
+
7
+ - Use `LAYERS` exposed by DSL plugins ([#2114](https://github.com/lynx-family/lynx-stack/pull/2114))
8
+
3
9
  ## 0.1.0
4
10
 
5
11
  ### Minor Changes
@@ -18,23 +24,23 @@
18
24
 
19
25
  ```js
20
26
  // webpack.config.js
21
- import { ExternalsLoadingPlugin } from '@lynx-js/externals-loading-webpack-plugin'
27
+ import { ExternalsLoadingPlugin } from "@lynx-js/externals-loading-webpack-plugin";
22
28
 
23
29
  export default {
24
30
  plugins: [
25
31
  new ExternalsLoadingPlugin({
26
- mainThreadLayer: 'main-thread',
27
- backgroundLayer: 'background',
32
+ mainThreadLayer: "main-thread",
33
+ backgroundLayer: "background",
28
34
  externals: {
29
35
  lodash: {
30
- url: 'http://lodash.lynx.bundle',
31
- background: { sectionPath: 'background' },
32
- mainThread: { sectionPath: 'main-thread' },
36
+ url: "http://lodash.lynx.bundle",
37
+ background: { sectionPath: "background" },
38
+ mainThread: { sectionPath: "main-thread" },
33
39
  },
34
40
  },
35
41
  }),
36
42
  ],
37
- }
43
+ };
38
44
  ```
39
45
 
40
46
  ## 0.0.1
@@ -45,14 +51,14 @@
45
51
 
46
52
  ```js
47
53
  // rslib.config.js
48
- import { defineExternalBundleRslibConfig } from '@lynx-js/lynx-bundle-rslib-config'
54
+ import { defineExternalBundleRslibConfig } from "@lynx-js/lynx-bundle-rslib-config";
49
55
 
50
56
  export default defineExternalBundleRslibConfig({
51
- id: 'utils-lib',
57
+ id: "utils-lib",
52
58
  source: {
53
59
  entry: {
54
- utils: './src/utils.ts',
60
+ utils: "./src/utils.ts",
55
61
  },
56
62
  },
57
- })
63
+ });
58
64
  ```
@@ -12,15 +12,6 @@ export interface EncodeOptions {
12
12
  */
13
13
  engineVersion?: string;
14
14
  }
15
- /**
16
- * The Layer name of background and main-thread.
17
- *
18
- * @public
19
- */
20
- export declare const LAYERS: {
21
- readonly BACKGROUND: "background";
22
- readonly MAIN_THREAD: "main-thread";
23
- };
24
15
  /**
25
16
  * The default lib config{@link LibConfig} for external bundle.
26
17
  *
@@ -46,7 +37,7 @@ export interface ExternalBundleLibConfig extends LibConfig {
46
37
  *
47
38
  * ```js
48
39
  * // rslib.config.js
49
- * import { defineExternalBundleRslibConfig, LAYERS } from '@lynx-js/lynx-bundle-rslib-config'
40
+ * import { defineExternalBundleRslibConfig } from '@lynx-js/lynx-bundle-rslib-config'
50
41
  *
51
42
  * export default defineExternalBundleRslibConfig({
52
43
  * id: 'utils-lib',
@@ -54,7 +45,7 @@ export interface ExternalBundleLibConfig extends LibConfig {
54
45
  * entry: {
55
46
  * utils: {
56
47
  * import: './src/utils.ts',
57
- * layer: LAYERS.BACKGROUND,
48
+ * layer: 'background',
58
49
  * }
59
50
  * }
60
51
  * }
@@ -69,7 +60,7 @@ export interface ExternalBundleLibConfig extends LibConfig {
69
60
  *
70
61
  * ```js
71
62
  * // rslib.config.js
72
- * import { defineExternalBundleRslibConfig, LAYERS } from '@lynx-js/lynx-bundle-rslib-config'
63
+ * import { defineExternalBundleRslibConfig } from '@lynx-js/lynx-bundle-rslib-config'
73
64
  *
74
65
  * export default defineExternalBundleRslibConfig({
75
66
  * id: 'utils-lib',
@@ -77,7 +68,7 @@ export interface ExternalBundleLibConfig extends LibConfig {
77
68
  * entry: {
78
69
  * utils: {
79
70
  * import: './src/utils.ts',
80
- * layer: LAYERS.MAIN_THREAD,
71
+ * layer: 'main-thread',
81
72
  * }
82
73
  * }
83
74
  * }
@@ -5,15 +5,6 @@ import { rsbuild } from '@rslib/core';
5
5
  import { RuntimeWrapperWebpackPlugin as BackgroundRuntimeWrapperWebpackPlugin } from '@lynx-js/runtime-wrapper-webpack-plugin';
6
6
  import { ExternalBundleWebpackPlugin } from './webpack/ExternalBundleWebpackPlugin.js';
7
7
  import { MainThreadRuntimeWrapperWebpackPlugin } from './webpack/MainThreadRuntimeWrapperWebpackPlugin.js';
8
- /**
9
- * The Layer name of background and main-thread.
10
- *
11
- * @public
12
- */
13
- export const LAYERS = {
14
- BACKGROUND: 'background',
15
- MAIN_THREAD: 'main-thread',
16
- };
17
8
  /**
18
9
  * The default lib config{@link LibConfig} for external bundle.
19
10
  *
@@ -80,7 +71,7 @@ function transformExternals(externals) {
80
71
  *
81
72
  * ```js
82
73
  * // rslib.config.js
83
- * import { defineExternalBundleRslibConfig, LAYERS } from '@lynx-js/lynx-bundle-rslib-config'
74
+ * import { defineExternalBundleRslibConfig } from '@lynx-js/lynx-bundle-rslib-config'
84
75
  *
85
76
  * export default defineExternalBundleRslibConfig({
86
77
  * id: 'utils-lib',
@@ -88,7 +79,7 @@ function transformExternals(externals) {
88
79
  * entry: {
89
80
  * utils: {
90
81
  * import: './src/utils.ts',
91
- * layer: LAYERS.BACKGROUND,
82
+ * layer: 'background',
92
83
  * }
93
84
  * }
94
85
  * }
@@ -103,7 +94,7 @@ function transformExternals(externals) {
103
94
  *
104
95
  * ```js
105
96
  * // rslib.config.js
106
- * import { defineExternalBundleRslibConfig, LAYERS } from '@lynx-js/lynx-bundle-rslib-config'
97
+ * import { defineExternalBundleRslibConfig } from '@lynx-js/lynx-bundle-rslib-config'
107
98
  *
108
99
  * export default defineExternalBundleRslibConfig({
109
100
  * id: 'utils-lib',
@@ -111,7 +102,7 @@ function transformExternals(externals) {
111
102
  * entry: {
112
103
  * utils: {
113
104
  * import: './src/utils.ts',
114
- * layer: LAYERS.MAIN_THREAD,
105
+ * layer: 'main-thread',
115
106
  * }
116
107
  * }
117
108
  * }
@@ -159,7 +150,14 @@ export function defineExternalBundleRslibConfig(userLibConfig, encodeOptions = {
159
150
  }
160
151
  const externalBundleEntryRsbuildPlugin = () => ({
161
152
  name: 'lynx:external-bundle-entry',
153
+ // ensure dsl plugin has exposed LAYERS
154
+ enforce: 'post',
162
155
  setup(api) {
156
+ // Get layer names from react-rsbuild-plugin
157
+ const LAYERS = api.useExposed(Symbol.for('LAYERS'));
158
+ if (!LAYERS) {
159
+ throw new Error('external-bundle-rsbuild-plugin requires exposed `LAYERS`.');
160
+ }
163
161
  api.modifyBundlerChain((chain) => {
164
162
  // copy entries
165
163
  const entries = chain.entryPoints.entries() ?? {};
package/lib/index.d.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * `@lynx-js/lynx-bundle-rslib-config` is the package that provides the configurations for bundling Lynx bundle with {@link https://rslib.rs/ | Rslib}.
5
5
  */
6
- export { defineExternalBundleRslibConfig, defaultExternalBundleLibConfig, LAYERS, } from './externalBundleRslibConfig.js';
6
+ export { defineExternalBundleRslibConfig, defaultExternalBundleLibConfig, } from './externalBundleRslibConfig.js';
7
7
  export type { EncodeOptions } from './externalBundleRslibConfig.js';
8
8
  export { ExternalBundleWebpackPlugin } from './webpack/ExternalBundleWebpackPlugin.js';
9
9
  export type { ExternalBundleWebpackPluginOptions } from './webpack/ExternalBundleWebpackPlugin.js';
package/lib/index.js CHANGED
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * `@lynx-js/lynx-bundle-rslib-config` is the package that provides the configurations for bundling Lynx bundle with {@link https://rslib.rs/ | Rslib}.
8
8
  */
9
- export { defineExternalBundleRslibConfig, defaultExternalBundleLibConfig, LAYERS, } from './externalBundleRslibConfig.js';
9
+ export { defineExternalBundleRslibConfig, defaultExternalBundleLibConfig, } from './externalBundleRslibConfig.js';
10
10
  export { ExternalBundleWebpackPlugin } from './webpack/ExternalBundleWebpackPlugin.js';
11
11
  export { MainThreadRuntimeWrapperWebpackPlugin } from './webpack/MainThreadRuntimeWrapperWebpackPlugin.js';
12
12
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynx-js/lynx-bundle-rslib-config-canary",
3
- "version": "0.1.0",
3
+ "version": "0.2.0-canary-20260120-2bc3e7ef",
4
4
  "description": "The rsbuild config for building Lynx bundle",
5
5
  "keywords": [
6
6
  "Rsbuild",
@@ -36,9 +36,12 @@
36
36
  "@lynx-js/tasm": "0.0.20"
37
37
  },
38
38
  "devDependencies": {
39
- "@rslib/core": "^0.15.0",
39
+ "@rslib/core": "^0.19.1",
40
40
  "vitest": "^3.2.4",
41
- "webpack": "^5.102.0"
41
+ "webpack": "^5.104.1",
42
+ "@lynx-js/react": "npm:@lynx-js/react-canary@0.116.0-canary-20260120-2bc3e7ef",
43
+ "@lynx-js/vitest-setup": "0.0.0",
44
+ "@lynx-js/react-rsbuild-plugin": "npm:@lynx-js/react-rsbuild-plugin-canary@0.12.6-canary-20260120-2bc3e7ef"
42
45
  },
43
46
  "engines": {
44
47
  "node": ">=18"