@lynx-js/template-webpack-plugin-canary 0.9.0-canary-20250921-d0ef559f → 0.9.1-canary-20251029-96545dd9
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 +7 -1
- package/lib/LynxTemplatePlugin.js +30 -32
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
# @lynx-js/template-webpack-plugin
|
|
2
2
|
|
|
3
|
-
## 0.9.
|
|
3
|
+
## 0.9.1-canary-20251029071231-96545dd9f966c07aa64437aefc781a9f3e260861
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Remove `compiler.hooks.initialize` as [it's not called in child compilers](https://github.com/web-infra-dev/rspack/blob/aa4ad886b900770787ecddd625d3e24a51b6b99c/packages/rspack/src/rspack.ts#L78). ([#1898](https://github.com/lynx-family/lynx-stack/pull/1898))
|
|
8
|
+
|
|
9
|
+
## 0.9.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
|
6
12
|
|
|
@@ -126,38 +126,36 @@ class LynxTemplatePluginImpl {
|
|
|
126
126
|
this.#options = options;
|
|
127
127
|
const { createHash } = compiler.webpack.util;
|
|
128
128
|
this.hash = createHash(compiler.options.output.hashFunction ?? 'xxhash64');
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
return this.#generateTemplate(compiler, compilation, filename);
|
|
160
|
-
});
|
|
129
|
+
// entryName to fileName conversion function
|
|
130
|
+
const userOptionFilename = this.#options.filename;
|
|
131
|
+
const filenameFunction = typeof userOptionFilename === 'function'
|
|
132
|
+
? userOptionFilename
|
|
133
|
+
// Replace '[name]' with entry name
|
|
134
|
+
: (entryName) => userOptionFilename.replace(/\[name\]/g, entryName);
|
|
135
|
+
/** output filenames for the given entry names */
|
|
136
|
+
const entryNames = Object.keys(compiler.options.entry);
|
|
137
|
+
const outputFileNames = new Set((entryNames.length > 0 ? entryNames : ['main']).map((name) => filenameFunction(name)));
|
|
138
|
+
outputFileNames.forEach((outputFileName) => {
|
|
139
|
+
// convert absolute filename into relative so that webpack can
|
|
140
|
+
// generate it at correct location
|
|
141
|
+
let filename = outputFileName;
|
|
142
|
+
if (path.resolve(filename) === path.normalize(filename)) {
|
|
143
|
+
filename = path.relative(
|
|
144
|
+
/** Once initialized the path is always a string */
|
|
145
|
+
compiler.options.output.path, filename);
|
|
146
|
+
}
|
|
147
|
+
compiler.hooks.thisCompilation.tap(this.name, (compilation) => {
|
|
148
|
+
compilation.hooks.processAssets.tapPromise({
|
|
149
|
+
name: this.name,
|
|
150
|
+
stage:
|
|
151
|
+
/**
|
|
152
|
+
* Generate the html after minification and dev tooling is done
|
|
153
|
+
* and source-map is generated
|
|
154
|
+
*/
|
|
155
|
+
compiler.webpack.Compilation
|
|
156
|
+
.PROCESS_ASSETS_STAGE_OPTIMIZE_HASH,
|
|
157
|
+
}, () => {
|
|
158
|
+
return this.#generateTemplate(compiler, compilation, filename);
|
|
161
159
|
});
|
|
162
160
|
});
|
|
163
161
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lynx-js/template-webpack-plugin-canary",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.1-canary-20251029-96545dd9",
|
|
4
4
|
"description": "Simplifies creation of Lynx template files to serve your webpack bundles",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"webpack",
|
|
@@ -40,10 +40,10 @@
|
|
|
40
40
|
"object.groupby": "^1.0.3"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@microsoft/api-extractor": "7.52.
|
|
44
|
-
"@types/css-tree": "^2.3.
|
|
43
|
+
"@microsoft/api-extractor": "7.52.15",
|
|
44
|
+
"@types/css-tree": "^2.3.11",
|
|
45
45
|
"@types/object.groupby": "^1.0.4",
|
|
46
|
-
"webpack": "^5.
|
|
46
|
+
"webpack": "^5.102.0",
|
|
47
47
|
"@lynx-js/test-tools": "0.0.0",
|
|
48
48
|
"@lynx-js/vitest-setup": "0.0.0"
|
|
49
49
|
},
|