@lynx-js/template-webpack-plugin-canary 0.6.10-canary-20250427-26985324 → 0.6.11-canary-20250515-ae9652a7
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 +11 -1
- package/lib/LynxEncodePlugin.d.ts +1 -7
- package/lib/LynxEncodePlugin.js +22 -19
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
# @lynx-js/template-webpack-plugin
|
|
2
2
|
|
|
3
|
-
## 0.6.
|
|
3
|
+
## 0.6.11-canary-20250515084615-ae9652a7a1d6247959bb41e7d76793300eddb741
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Be compatible with rspack-manifest-plugin. ([#812](https://github.com/lynx-family/lynx-stack/pull/812))
|
|
8
|
+
|
|
9
|
+
Now only the `[name].lynx.bundle` and `[name].web.bundle` would exist in `manifest.json`.
|
|
10
|
+
|
|
11
|
+
See [lynx-family/lynx-stack#763](https://github.com/lynx-family/lynx-stack/issues/763) for details.
|
|
12
|
+
|
|
13
|
+
## 0.6.10
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
|
6
16
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Compiler } from 'webpack';
|
|
2
2
|
import type { EncodeCSSOptions } from './css/encode.js';
|
|
3
3
|
import type { CSS } from './index.js';
|
|
4
4
|
/**
|
|
@@ -81,12 +81,6 @@ export declare class LynxEncodePluginImpl {
|
|
|
81
81
|
#private;
|
|
82
82
|
name: string;
|
|
83
83
|
constructor(compiler: Compiler, options: Required<LynxEncodePluginOptions>);
|
|
84
|
-
/**
|
|
85
|
-
* The deleteDebuggingAssets delete all the assets that are inlined into the template.
|
|
86
|
-
*/
|
|
87
|
-
deleteDebuggingAssets(compilation: Compilation, assets: ({
|
|
88
|
-
name: string;
|
|
89
|
-
} | undefined)[]): void;
|
|
90
84
|
protected options: Required<LynxEncodePluginOptions>;
|
|
91
85
|
}
|
|
92
86
|
export declare function isDebug(): boolean;
|
package/lib/LynxEncodePlugin.js
CHANGED
|
@@ -89,6 +89,20 @@ export class LynxEncodePluginImpl {
|
|
|
89
89
|
|| compiler.options.mode === 'development';
|
|
90
90
|
compiler.hooks.thisCompilation.tap(this.name, compilation => {
|
|
91
91
|
const templateHooks = LynxTemplatePlugin.getLynxTemplatePluginHooks(compilation);
|
|
92
|
+
const inlinedAssets = new Set();
|
|
93
|
+
const { Compilation } = compiler.webpack;
|
|
94
|
+
compilation.hooks.processAssets.tap({
|
|
95
|
+
name: this.name,
|
|
96
|
+
// `PROCESS_ASSETS_STAGE_REPORT` is the last stage of the `processAssets` hook.
|
|
97
|
+
// We need to run our asset deletion after this stage to ensure all assets have been processed.
|
|
98
|
+
// E.g.: upload source-map to sentry.
|
|
99
|
+
stage: Compilation.PROCESS_ASSETS_STAGE_REPORT + 1,
|
|
100
|
+
}, () => {
|
|
101
|
+
inlinedAssets.forEach((name) => {
|
|
102
|
+
compilation.deleteAsset(name);
|
|
103
|
+
});
|
|
104
|
+
inlinedAssets.clear();
|
|
105
|
+
});
|
|
92
106
|
templateHooks.beforeEncode.tapPromise({
|
|
93
107
|
name: this.name,
|
|
94
108
|
stage: LynxEncodePlugin.BEFORE_ENCODE_STAGE,
|
|
@@ -96,14 +110,14 @@ export class LynxEncodePluginImpl {
|
|
|
96
110
|
const { encodeData } = args;
|
|
97
111
|
const { manifest } = encodeData;
|
|
98
112
|
if (!isDebug() && !isDev && !isRsdoctor()) {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
113
|
+
[
|
|
114
|
+
encodeData.lepusCode.root,
|
|
115
|
+
...encodeData.lepusCode.chunks,
|
|
116
|
+
...Object.keys(manifest).map(name => ({ name })),
|
|
117
|
+
...encodeData.css.chunks,
|
|
118
|
+
]
|
|
119
|
+
.filter(asset => asset !== undefined)
|
|
120
|
+
.forEach(asset => inlinedAssets.add(asset.name));
|
|
107
121
|
}
|
|
108
122
|
encodeData.manifest = {
|
|
109
123
|
// `app-service.js` is the entry point of a template.
|
|
@@ -147,17 +161,6 @@ export class LynxEncodePluginImpl {
|
|
|
147
161
|
});
|
|
148
162
|
});
|
|
149
163
|
}
|
|
150
|
-
/**
|
|
151
|
-
* The deleteDebuggingAssets delete all the assets that are inlined into the template.
|
|
152
|
-
*/
|
|
153
|
-
deleteDebuggingAssets(compilation, assets) {
|
|
154
|
-
assets
|
|
155
|
-
.filter(asset => asset !== undefined)
|
|
156
|
-
.forEach(asset => deleteAsset(asset));
|
|
157
|
-
function deleteAsset({ name }) {
|
|
158
|
-
return compilation.deleteAsset(name);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
164
|
#APP_SERVICE_NAME = '/app-service.js';
|
|
162
165
|
#appServiceBanner() {
|
|
163
166
|
const loadScriptBanner = `(function(){'use strict';function n({tt}){`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lynx-js/template-webpack-plugin-canary",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.11-canary-20250515-ae9652a7",
|
|
4
4
|
"description": "Simplifies creation of Lynx template files to serve your webpack bundles",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"webpack",
|
|
@@ -40,12 +40,12 @@
|
|
|
40
40
|
"object.groupby": "^1.0.3"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@microsoft/api-extractor": "7.52.
|
|
43
|
+
"@microsoft/api-extractor": "7.52.8",
|
|
44
44
|
"@types/css-tree": "^2.3.10",
|
|
45
45
|
"@types/object.groupby": "^1.0.4",
|
|
46
|
-
"webpack": "^5.99.
|
|
47
|
-
"@lynx-js/
|
|
48
|
-
"@lynx-js/
|
|
46
|
+
"webpack": "^5.99.8",
|
|
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"
|