@lynx-js/template-webpack-plugin-canary 0.8.3-canary-20250801-d2961703 → 0.8.4-canary-20250815-51a0b190
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/LynxEncodePlugin.js +24 -5
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
# @lynx-js/template-webpack-plugin
|
|
2
2
|
|
|
3
|
-
## 0.8.
|
|
3
|
+
## 0.8.4-canary-20250815073754-51a0b19078cb18c13f4f3e2ca4f471aa4ddeaa05
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Fix invalid `module.exports=;` syntax in app-service.js. ([#1501](https://github.com/lynx-family/lynx-stack/pull/1501))
|
|
8
|
+
|
|
9
|
+
## 0.8.3
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
6
12
|
|
package/lib/LynxEncodePlugin.js
CHANGED
|
@@ -134,10 +134,7 @@ export class LynxEncodePluginImpl {
|
|
|
134
134
|
// ```
|
|
135
135
|
'/app-service.js': [
|
|
136
136
|
this.#appServiceBanner(),
|
|
137
|
-
|
|
138
|
-
';module.exports=',
|
|
139
|
-
Object.keys(inlinedManifest).map(name => `lynx.requireModule('${this.#formatJSName(name, '/')}',globDynamicComponentEntry?globDynamicComponentEntry:'__Card__')`).join(','),
|
|
140
|
-
';',
|
|
137
|
+
this.#appServiceContent(externalManifest, inlinedManifest, publicPath),
|
|
141
138
|
this.#appServiceFooter(),
|
|
142
139
|
].join(''),
|
|
143
140
|
...Object.fromEntries(Object.entries(inlinedManifest).map(([name, content]) => [
|
|
@@ -165,13 +162,35 @@ export class LynxEncodePluginImpl {
|
|
|
165
162
|
const amdBanner = `tt.define('${this.#APP_SERVICE_NAME}',function(e,module,_,i,l,u,a,c,s,f,p,d,h,v,g,y,lynx){`;
|
|
166
163
|
return loadScriptBanner + amdBanner;
|
|
167
164
|
}
|
|
165
|
+
#appServiceContent(externalManifest, inlinedManifest, publicPath) {
|
|
166
|
+
const parts = [];
|
|
167
|
+
const externalKeys = Object.keys(externalManifest);
|
|
168
|
+
if (externalKeys.length > 0) {
|
|
169
|
+
const externalRequires = externalKeys
|
|
170
|
+
.map(name => `lynx.requireModuleAsync(${JSON.stringify(this.#formatJSName(name, publicPath))})`)
|
|
171
|
+
.join(',');
|
|
172
|
+
parts.push(externalRequires, ';');
|
|
173
|
+
}
|
|
174
|
+
const inlinedKeys = Object.keys(inlinedManifest);
|
|
175
|
+
if (inlinedKeys.length > 0) {
|
|
176
|
+
parts.push('module.exports=');
|
|
177
|
+
const inlinedRequires = inlinedKeys
|
|
178
|
+
.map(name => `lynx.requireModule(${JSON.stringify(this.#formatJSName(name, '/'))},globDynamicComponentEntry?globDynamicComponentEntry:'__Card__')`)
|
|
179
|
+
.join(',');
|
|
180
|
+
parts.push(inlinedRequires, ';');
|
|
181
|
+
}
|
|
182
|
+
return parts.join('');
|
|
183
|
+
}
|
|
168
184
|
#appServiceFooter() {
|
|
169
185
|
const loadScriptFooter = `}return{init:n}})()`;
|
|
170
186
|
const amdFooter = `});return tt.require('${this.#APP_SERVICE_NAME}');`;
|
|
171
187
|
return amdFooter + loadScriptFooter;
|
|
172
188
|
}
|
|
173
189
|
#formatJSName(name, publicPath) {
|
|
174
|
-
|
|
190
|
+
const base = !publicPath || publicPath === 'auto' ? '/' : publicPath;
|
|
191
|
+
const prefixed = base.endsWith('/') ? base : `${base}/`;
|
|
192
|
+
const trimmed = name.startsWith('/') ? name.slice(1) : name;
|
|
193
|
+
return `${prefixed}${trimmed}`;
|
|
175
194
|
}
|
|
176
195
|
#shouldInlineScript(name, size) {
|
|
177
196
|
const inlineConfig = this.options.inlineScripts;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lynx-js/template-webpack-plugin-canary",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.4-canary-20250815-51a0b190",
|
|
4
4
|
"description": "Simplifies creation of Lynx template files to serve your webpack bundles",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"webpack",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"@microsoft/api-extractor": "7.52.10",
|
|
44
44
|
"@types/css-tree": "^2.3.10",
|
|
45
45
|
"@types/object.groupby": "^1.0.4",
|
|
46
|
-
"webpack": "^5.
|
|
46
|
+
"webpack": "^5.101.2",
|
|
47
47
|
"@lynx-js/test-tools": "0.0.0",
|
|
48
48
|
"@lynx-js/vitest-setup": "0.0.0"
|
|
49
49
|
},
|