@lynx-js/template-webpack-plugin-canary 0.6.7 → 0.6.8-canary-20250401-72432428

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/template-webpack-plugin
2
2
 
3
+ ## 0.6.8-canary-20250401115155-7243242801e3a8ca0213c0ef642f69a22c39960e
4
+
5
+ ### Patch Changes
6
+
7
+ - fix: add enableCSSInvalidation for encodeCSS of css HMR, this will fix pseudo-class (such as `:active`) not working in HMR. ([#435](https://github.com/lynx-family/lynx-stack/pull/435))
8
+
3
9
  ## 0.6.7
4
10
 
5
11
  ### Patch Changes
@@ -29,7 +35,7 @@
29
35
  - Add `defaultOverflowVisible` option to `LynxTemplatePlugin`. ([#78](https://github.com/lynx-family/lynx-stack/pull/78))
30
36
 
31
37
  ```js
32
- import { LynxTemplatePlugin } from '@lynx-js/template-webpack-plugin';
38
+ import { LynxTemplatePlugin } from "@lynx-js/template-webpack-plugin";
33
39
 
34
40
  new LynxTemplatePlugin({
35
41
  defaultOverflowVisible: false,
@@ -48,10 +54,10 @@
48
54
  - 1abf8f0: Add `entryNames` parameter to `beforeEncode` hook.
49
55
 
50
56
  ```js
51
- import { LynxTemplatePlugin } from '@lynx-js/template-webpack-plugin';
57
+ import { LynxTemplatePlugin } from "@lynx-js/template-webpack-plugin";
52
58
 
53
59
  const hooks = LynxTemplatePlugin.getLynxTemplatePluginHooks(compilation);
54
- hooks.beforeEncode.tap('MyPlugin', ({ entryNames }) => {
60
+ hooks.beforeEncode.tap("MyPlugin", ({ entryNames }) => {
55
61
  console.log(entryNames);
56
62
  });
57
63
  ```
@@ -1,4 +1,5 @@
1
1
  import type { Compilation, Compiler } from 'webpack';
2
+ import type { EncodeCSSOptions } from './css/encode.js';
2
3
  import type { CSS } from './index.js';
3
4
  /**
4
5
  * The options for LynxEncodePluginOptions
@@ -45,20 +46,7 @@ export declare class LynxEncodePlugin {
45
46
  * )).toString('base64'),
46
47
  * ```
47
48
  */
48
- static encodeCSS(cssChunks: string[], options: {
49
- /**
50
- * {@inheritdoc @lynx-js/react-rsbuild-plugin#PluginReactLynxOptions.enableCSSSelector}
51
- */
52
- enableCSSSelector: boolean;
53
- /**
54
- * {@inheritdoc @lynx-js/react-rsbuild-plugin#PluginReactLynxOptions.enableRemoveCSSScope}
55
- */
56
- enableRemoveCSSScope: boolean;
57
- /**
58
- * {@inheritdoc @lynx-js/react-rsbuild-plugin#PluginReactLynxOptions.enableRemoveCSSScope}
59
- */
60
- targetSdkVersion: string;
61
- }, plugins?: CSS.Plugin[], encode?: (options: any) => Promise<{
49
+ static encodeCSS(cssChunks: string[], options: EncodeCSSOptions, plugins?: CSS.Plugin[], encode?: (options: any) => Promise<{
62
50
  buffer: Buffer;
63
51
  }>): Promise<Buffer>;
64
52
  /**
@@ -103,3 +91,4 @@ export declare class LynxEncodePluginImpl {
103
91
  }
104
92
  export declare function isDebug(): boolean;
105
93
  export declare function isRsdoctor(): boolean;
94
+ export type { EncodeCSSOptions } from './css/encode.js';
@@ -1,5 +1,10 @@
1
1
  import type { CSS } from '../index.js';
2
- export declare function encodeCSS(cssChunks: string[], { enableCSSSelector, enableRemoveCSSScope, targetSdkVersion, }: {
2
+ /**
3
+ * The options for encoding CSS.
4
+ *
5
+ * @public
6
+ */
7
+ export interface EncodeCSSOptions {
3
8
  /**
4
9
  * {@inheritdoc @lynx-js/react-rsbuild-plugin#PluginReactLynxOptions.enableCSSSelector}
5
10
  */
@@ -8,10 +13,15 @@ export declare function encodeCSS(cssChunks: string[], { enableCSSSelector, enab
8
13
  * {@inheritdoc @lynx-js/react-rsbuild-plugin#PluginReactLynxOptions.enableRemoveCSSScope}
9
14
  */
10
15
  enableRemoveCSSScope: boolean;
16
+ /**
17
+ * {@inheritdoc @lynx-js/react-rsbuild-plugin#PluginReactLynxOptions.enableCSSInvalidation}
18
+ */
19
+ enableCSSInvalidation: boolean;
11
20
  /**
12
21
  * {@inheritdoc @lynx-js/react-rsbuild-plugin#PluginReactLynxOptions.enableRemoveCSSScope}
13
22
  */
14
23
  targetSdkVersion: string;
15
- }, plugins?: CSS.Plugin[], encode?: (options: any) => Promise<{
24
+ }
25
+ export declare function encodeCSS(cssChunks: string[], { enableCSSSelector, enableRemoveCSSScope, enableCSSInvalidation, targetSdkVersion, }: EncodeCSSOptions, plugins?: CSS.Plugin[], encode?: (options: any) => Promise<{
16
26
  buffer: Buffer;
17
27
  }>): Promise<Buffer>;
package/lib/css/encode.js CHANGED
@@ -3,7 +3,7 @@
3
3
  // LICENSE file in the root directory of this source tree.
4
4
  import { removeFunctionWhiteSpace } from '@lynx-js/css-serializer/dist/plugins/removeFunctionWhiteSpace.js';
5
5
  import { cssChunksToMap } from './cssChunksToMap.js';
6
- export async function encodeCSS(cssChunks, { enableCSSSelector, enableRemoveCSSScope, targetSdkVersion, }, plugins = [removeFunctionWhiteSpace()],
6
+ export async function encodeCSS(cssChunks, { enableCSSSelector, enableRemoveCSSScope, enableCSSInvalidation, targetSdkVersion, }, plugins = [removeFunctionWhiteSpace()],
7
7
  // biome-ignore lint/suspicious/noExplicitAny: <explanation>
8
8
  encode = (options) => {
9
9
  const buffer = Buffer.from(JSON.stringify(options));
@@ -19,6 +19,7 @@ encode = (options) => {
19
19
  useLepusNG: true,
20
20
  bundleModuleMode: 'ReturnByFunction',
21
21
  enableCSSSelector,
22
+ enableCSSInvalidation,
22
23
  targetSdkVersion,
23
24
  },
24
25
  sourceContent: {
package/lib/index.d.ts CHANGED
@@ -6,6 +6,6 @@
6
6
  export { LynxTemplatePlugin } from './LynxTemplatePlugin.js';
7
7
  export type { LynxTemplatePluginOptions, TemplateHooks, } from './LynxTemplatePlugin.js';
8
8
  export { LynxEncodePlugin } from './LynxEncodePlugin.js';
9
- export type { LynxEncodePluginOptions } from './LynxEncodePlugin.js';
9
+ export type { LynxEncodePluginOptions, EncodeCSSOptions, } from './LynxEncodePlugin.js';
10
10
  export * as CSSPlugins from './css/plugins/index.js';
11
11
  export * as CSS from './css/index.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynx-js/template-webpack-plugin-canary",
3
- "version": "0.6.7",
3
+ "version": "0.6.8-canary-20250401-72432428",
4
4
  "description": "Simplifies creation of Lynx template files to serve your webpack bundles",
5
5
  "keywords": [
6
6
  "webpack",
@@ -44,8 +44,8 @@
44
44
  "@types/css-tree": "^2.3.10",
45
45
  "@types/object.groupby": "^1.0.4",
46
46
  "webpack": "^5.98.0",
47
- "@lynx-js/test-tools": "0.0.0",
48
- "@lynx-js/vitest-setup": "0.0.0"
47
+ "@lynx-js/vitest-setup": "0.0.0",
48
+ "@lynx-js/test-tools": "0.0.0"
49
49
  },
50
50
  "engines": {
51
51
  "node": ">=18"